npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

sakuramml

v0.1.42

Published

MML(Music Macro Language) compiler, MML to MIDI

Downloads

212

Readme

sakuramml-rust

sakruamml is a MML/ABC to MIDI compier.

This compiler that converts the MML/ABC into MIDI files. MML is a notation system that represents sheet music using text such as cde. It is a tool that allows you to easily create music. It is made with Rust and works on multiple platforms (macOS/Windows/Linux/WebAssembly).

sakuramml is a historic music production tool developed around the year 2000. It was recognized as an award-winning entry in the "Online Software Grand Prize 2001" in Japan, and was even featured in high school IT textbooks.

Samples

Many users have composed music using sakuramml, and over 2,000 songs have been posted on this forum. Additionally, more than 100 songs are compatible with sakuramml-rust.

Tutorial

An online tutorial is available. You can learn the commands while listening to the music.

Install

Binary - command line tool

Web Assembly - Web Player

Compile with Rust

Please install Rust compier.

git clone https://github.com/kujirahand/sakuramml-rust.git
cd sakuramml-rust
cargo build --release

When compiled, the executable file will be saved in target/release/sakuramml.

CLI Usage

Please make text file test.mml. And execute the following command to generate a MIDI file test.mid.

# Compile MML file to MIDI file
./sakuramml test.mml test.mid
# Compile MML file to MIDI file, can omit output file
./sakuramml test.mml

You can test MML command easily with --eval option.

./sakuramml --eval "o4l4 cege c1"

You can check MIDI file with --dump option.

./sakuramml --dump test.mid

MML Basic

You can play the following text as a music.

o4 cdefgab>c<bagfedc

You can specify tracks(TR) and channels(CH), Voice(@).

TR(1) CH(1) @1 l1 ceg^
TR(2) CH(2) @1 l1 egb^

Harmony

You can play chords.

l4 `ceg` `dfa`8 `egb`8 `ceg`

Time Pointer

You can specify the writing position using a time pointer(TIME).

// top
TIME(1:1:0) cdef
TIME(1:1:0) efga

// 2mes
TIME(2:1:0) cdef

SUB{...} command let time pointer back.

SUB{ cdef  c }
SUB{ efga  e }
     rrrr  g

Rhythm macro

In the rhythm macro, one character is treated as one instruction regardless of uppercase or lowercase letters. Rhythm macro definitions are described as "$(char){definition}".

// define macro
$b{n36,}
$h{n42,}
$o{n46,}
// new macro
$S{n37,}
CH(10)
// sample
Rhythm{
 [4 l8
   brSr bbsr r-1
   hoho hoho
 ]
}

How to specify tuplets

The tuplets are written as "DIV{...}", but "DIV" can be omitted and written as "{ceg}".

l4 DIV{cde} f DIV{gab} >c<
l4 {cde} f {gab} >c<
l4 {cde}c {gfe}d {c^d} e {d^e} f

The tuplets can nest.

l1 { c d {efe} d } c

Velocity

Using the v command, you can specify the velocity. It can be set within the range of 0 to 127.

l8 v127 cdef v64 cdef v127 c^^^

"(" decreases the velocity by 8, and ")" increases the velocity by 8.

v127 c ( c ( c (( c )) c ) c ) c  

Reservation notation

  • v.onTime(low, high, len, ...) OR v.T(low,high,len,...)
    • The value that should be specified for len is the tick. When specifying the note length, it should be written as !4, for example.
  • v.onNote(v1, v2, v3, ...) OR v.N(v1,v2,v3,...)
  • t.onNote(v1, v2, v3, ...) OR t.N(v1,v2,v3,...)
  • (ControllChange or PB or p).onTime(low, high, len, ...)
v.onTime(0,127,!1) l8cccccccc
BR(2) PB.onTime(-8192,0,!4) l4c PB(0) efg^

Macro

It can define Macro.

// define Macro
STR P1 = {cdefg}
#P1 = {cdefg}
// expand Macro
P1
#P1

The macro can replace with arguments. It replaces #?1 #?2 #?3 ...

// define macro
#Unison = { Key=#?2 Sub{ #?1 } Key=0 #?1 }
// expand macro with arguments 
#Unison{cde},7

Script

It can use IF/FOR/WHILE/FUNCTION script.

// IF 
INT A = 3
INT B = 5
IF (A == B) { PRINT({A == B}) } ELSE { PRINT({A != B}) }

// FOR
FOR (INT N=1; N < 5; N++) {
  PRINT(N)
}

Variables

It can define variables of INT, STR, and ARRAY types.

// define variables
INT I1=30
STR S1={abcd}
ARRAY A1=(1,2,3)

// use variables
PRINT(I1) // 30
PRINT(S1) // abcd
PRINT(A1) // (1,2,3)
PRINT(A1(2)) // 3

Replace {i} with {c} in the value of the string variable S1 and S2.

// define variables
STR S1={iiri iiri}
// replace {i} to {c}
S1.s({i}, {c})
PRINT(S1) // ccrc ccrc

// REPLACE function
STR S2 = REPLACE({iiri iiri}, {i}, {c})
PRINT(S2) // ccrc ccrc

reference

Related Repository