"sakruamml" is a MML/ABC to MIDI compier.
This compiler that converts the text of "cde" into MIDI files. 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).
- GitHub/sakuramml-rust
- crate.io/sakuramml
- npm/sakuramml
- Related repository
- GitHub/picosakura ... web player
- GitHub/picosakura-rust ... local player
- Pico-Sakura --- WebAssembly version
Please install Rust compier.
$ git clone https://github.com/kujirahand/sakuramml-rust.git
$ cd sakuramml-rust
$ cargo build --release
target/release/sakuramml
is compiler.
Please make text file "test.mml". Execute the following command to generate a MIDI file.
$ sakuramml test.mml
o4 cdefgab>c<bagfedc
TR=1 CH=1 l1 ceg^
l4 `ceg` `dfa`8 `egb`8 `ceg`
// 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
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
]
}
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
"(" decreases the velocity by 8, and ")" increases the velocity by 8.
v127 c ( c ( c (( c )) c ) c ) c
`ceg` `dfa` `egb` `ceg`
- v.onTime(low, high, len, ...) / 省略形 v.T(low,high,len,...)
- v.onNote(v1, v2, v3, ...) / 省略形 v.N(v1,v2,v3,...)
- t.onNote(v1, v2, v3, ...) / 省略形 t.N(v1,v2,v3,...)
- (ControllChange または PB または p).onTime(low, high, len, ...)
v.onTime(0,127,!1)l8cccccccc
BR(2) PB.onTime(-8192,0,!4) l4c PB(0) efg^
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