Skip to content

Commit

Permalink
Finalize PR
Browse files Browse the repository at this point in the history
  • Loading branch information
infojunkie committed Sep 17, 2024
1 parent 0e267d4 commit 7df28ea
Show file tree
Hide file tree
Showing 1,807 changed files with 2,344,802 additions and 307 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ test/data/output/*
cache/*
!.gitkeep
__pycache__
.mmaDB
.mmaDB
*.log
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,25 @@ A suite of tools to convert MusicXML scores to MIDI via [Musical MIDI Accompanim
- `git submodule update --init --recursive`
- `npm install && npm run build`

# Converting a MusicXML score
# Convert a MusicXML score to MIDI
- `npm run --silent convert:unroll song.musicxml` to unroll a MusicXML score by expanding all jumps and repeats at `stdout`
- `npm run --silent convert:mma song.musicxml` to both unroll a score and convert it to an MMA script at `stdout`
- `npm run --silent convert:groove groove-name [chords="A,B,C"] [tempo=X] [count=Y] [keysig=Z]` to generate a groove MMA script at `stdout`
- `npm run convert:midi /path/to/song.mma` to convert an MMA script to MIDI `/path/to/song.mid`
- `npm run --silent convert:timemap song.musicxml` to convert a score to a timemap JSON file at `stdout`
- `./scripts/midi-timemap.js song.mid` to convert a MIDI file to a timemap JSON file at `stdout`
- `./src/js/midi-timemap.js song.mid` to convert a MIDI file to a timemap JSON file at `stdout`

# Serving a conversion API endpoint
# Serve a conversion API endpoint
- `PORT=3000 npm run develop` for development (including hot-reload)
- `PORT=3000 npm run start` for production
- `curl -sSf -F"musicXml=@test/data/salma-ya-salama.musicxml" -F"globalGroove=Maqsum" http://localhost:3000/convert -o "salma-ya-salama.mid"`
- `curl -sSf -F"groove=Maqsum" -F"chords=I, vi, ii, V7" -F"count=8" http://localhost:3000/groove -o "maqsum.mid"`
- `curl -sSf -F"jq=.[] |= {groove,description,timeSignature}" http://localhost:3000/grooves.json`

# Other operations
- Scrape MusicXML examples from the official site: `./src/js/musicxml-examples --output=./test/data/examples`
- Convert MMA grooves to MusicXML: `./src/js/musicxml-grooves --output=./test/data/grooves`

# Theory of operation
This converter aims to create a valid MMA accompaniment script out of a MusicXML score. The MMA script is then converted to MIDI using the bundled `mma` tool. To accomplish this, the converter expects to find the following information in the sheet:

Expand Down
1 change: 1 addition & 0 deletions build/filter.sef.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"N":"package","version":"10","packageVersion":"1","saxonVersion":"SaxonJS 2.6","target":"JS","targetVersion":"2","name":"TOP-LEVEL","relocatable":"true","buildDateTime":"2024-09-16T22:47:15.421-07:00","ns":"xml=~ xsl=~","C":[{"N":"co","binds":"","id":"0","vis":"PUBLIC","ex:uniform":"true","C":[{"N":"globalParam","name":"Q{}filter","sType":"* ","slots":"200","module":"filter.xsl","flags":"r","as":"","ns":"xml=~ xsl=~","C":[{"N":"str","sType":"1AS ","val":"","role":"select"}]}]},{"N":"co","id":"1","binds":"0 1","C":[{"N":"mode","onNo":"TC","flags":"","patternSlots":"0","prec":"","C":[{"N":"templateRule","rank":"0","prec":"0","seq":"1","ns":"xml=~ xsl=~","minImp":"0","flags":"s","slots":"200","line":"23","module":"filter.xsl","expand-text":"false","match":"*[local-name()=tokenize($filter,'\\|')]","prio":"0.5","matches":"NE","C":[{"N":"p.withPredicate","role":"match","sType":"1NE","ns":"= xml=~ fn=~ xsl=~ ","C":[{"N":"p.nodeTest","test":"NE"},{"N":"gc","op":"=","comp":"GAC|http://www.w3.org/2005/xpath-functions/collation/codepoint","card":"1:1","C":[{"N":"fn","name":"local-name","C":[{"N":"dot"}]},{"N":"fn","name":"tokenize","C":[{"N":"treat","as":"AS","diag":"0|0||tokenize","C":[{"N":"check","card":"?","diag":"0|0||tokenize","C":[{"N":"cvUntyped","to":"AS","diag":"0|0||tokenize","C":[{"N":"check","card":"?","diag":"0|0||tokenize","C":[{"N":"data","diag":"0|0||tokenize","C":[{"N":"gVarRef","name":"Q{}filter","bSlot":"0"}]}]}]}]}]},{"N":"str","val":"\\|"}]}]}]},{"N":"empty","sType":"0 ","role":"action"}]},{"N":"templateRule","rank":"1","prec":"0","seq":"0","ns":"xml=~ xsl=~","minImp":"0","flags":"s","slots":"200","line":"17","module":"filter.xsl","expand-text":"false","match":"node()|@*","prio":"-0.5","matches":"N u[NT,NP,NC,NE]","C":[{"N":"p.nodeTest","role":"match","test":"N u[NT,NP,NC,NE]","sType":"1N u[NT,NP,NC,NE]"},{"N":"copy","sType":"1N u[1NT ,1NP ,1NC ,1NE ] ","flags":"cin","role":"action","line":"18","C":[{"N":"applyT","sType":"* ","line":"19","mode":"#unnamed","bSlot":"1","C":[{"N":"docOrder","sType":"*N u[N u[N u[N u[NT,NP],NC],NE],NA]","role":"select","line":"19","C":[{"N":"union","op":"|","sType":"*N u[N u[N u[N u[NT,NP],NC],NE],NA]","ns":"= xml=~ fn=~ xsl=~ ","C":[{"N":"axis","name":"child","nodeTest":"*N u[NT,NP,NC,NE]"},{"N":"axis","name":"attribute","nodeTest":"*NA"}]}]}]}]}]},{"N":"templateRule","rank":"2","prec":"0","seq":"0","ns":"xml=~ xsl=~","minImp":"0","flags":"s","slots":"200","line":"17","module":"filter.xsl","expand-text":"false","match":"node()|@*","prio":"-0.5","matches":"NA","C":[{"N":"p.nodeTest","role":"match","test":"NA","sType":"1NA"},{"N":"copy","sType":"1NA ","flags":"cin","role":"action","line":"18","C":[{"N":"applyT","sType":"* ","line":"19","mode":"#unnamed","bSlot":"1","C":[{"N":"docOrder","sType":"*N u[N u[N u[N u[NT,NP],NC],NE],NA]","role":"select","line":"19","C":[{"N":"union","op":"|","sType":"*N u[N u[N u[N u[NT,NP],NC],NE],NA]","ns":"= xml=~ fn=~ xsl=~ ","C":[{"N":"axis","name":"child","nodeTest":"*N u[NT,NP,NC,NE]"},{"N":"axis","name":"attribute","nodeTest":"*NA"}]}]}]}]}]}]}]},{"N":"overridden"},{"N":"output","C":[{"N":"property","name":"Q{http://saxon.sf.net/}stylesheet-version","value":"10"},{"N":"property","name":"omit-xml-declaration","value":"no"},{"N":"property","name":"indent","value":"yes"}]},{"N":"decimalFormat"}],"Σ":"c521f3b7"}
2 changes: 1 addition & 1 deletion build/groove.sef.json

Large diffs are not rendered by default.

113 changes: 0 additions & 113 deletions build/grooves.json
Original file line number Diff line number Diff line change
Expand Up @@ -967,119 +967,6 @@
}
]
},
{
"groove": "JazzBasieAQuantized",
"description": "4 bars main.",
"size": 4,
"timeSignature": "4/4",
"tracks": [
{
"track": "BASS-11",
"voice": [
"AcousticBass",
"AcousticBass",
"AcousticBass",
"AcousticBass"
],
"midi": [
32,
32,
32,
32
],
"sequence": [
"1 288t 1 85; 2.97917 192t 2# 74; 3.96875 192t 3 85; 4.96875 288t 1 73",
"2.96875 288t 1 82; 4.96875 288t 1 84",
"2.96875 192t 5 81; 3.95833 192t 3 81; 4.96875 288t 1 73",
"2.95833 288t 5 82"
]
},
{
"track": "CHORD-12",
"voice": [
"Piano1",
"Piano1",
"Piano1",
"Piano1"
],
"midi": [
0,
0,
0,
0
],
"sequence": [
"1.66667 48t 63 63 63 63 63 63 63 63; 1.67708 48t 67 67 67 67 67 67 67 67; 4.69792 96t 64 64 64 64 64 64 64 64; 4.70833 96t 59 59 59 59 59 59 59 59; 4.71875 48t 67 67 67 67 67 67 67 67",
"1.66667 48t 59 59 59 59 59 59 59 59; 1.66667 96t 66 66 66 66 66 66 66 66; 1.6875 48t 62 62 62 62 62 62 62 62",
" z ",
" z "
]
},
{
"track": "DRUM-CLOSEDHIHAT",
"voice": [
"ClosedHiHat",
"ClosedHiHat",
"ClosedHiHat",
"ClosedHiHat"
],
"midi": [
42,
42,
42,
42
],
"sequence": [
"2 1t 107 ; 2.55 1t 0 ; 4 1t 115 ; 4.55 1t 0 ",
"2 1t 108 ; 2.55 1t 0 ; 4 1t 110 ; 4.55 1t 0 ",
"2 1t 114 ; 2.55 1t 0 ; 4 1t 106 ; 4.55 1t 0 ",
"2 1t 106 ; 2.55 1t 0 ; 4 1t 109 ; 4.55 1t 0 "
]
},
{
"track": "DRUM-KICKDRUM1",
"voice": [
"KickDrum1",
"KickDrum1",
"KickDrum1",
"KickDrum1"
],
"midi": [
36,
36,
36,
36
],
"sequence": [
" z ",
" z ",
" z ",
"3.66 1t 17 ; 4 1t 0 "
]
},
{
"track": "DRUM-OPENHIHAT",
"voice": [
"OpenHiHat",
"OpenHiHat",
"OpenHiHat",
"OpenHiHat"
],
"midi": [
46,
46,
46,
46
],
"sequence": [
"1 1t 86 ; 1.89583 1t 0 ; 2.66 1t 81 ; 2.88542 1t 0 ; 3 1t 74 ; 3.57812 1t 0 ; 3.66 1t 86 ; 4.15625 1t 0 ; 4.66 1t 82 ; 4.83854 1t 0 ",
"1 1t 84 ; 1.88542 1t 0 ; 2.66 1t 75 ; 2.88542 1t 0 ; 3 1t 80 ; 3.90625 1t 0 ; 4.66 1t 82 ; 4.84896 1t 0 ",
"1 1t 86 ; 1.89583 1t 0 ; 2.66 1t 80 ; 2.88542 1t 0 ; 3 1t 85 ; 3.88542 1t 0 ; 4.66 1t 77 ; 4.82812 1t 0 ",
"1 1t 74 ; 1.90625 1t 0 ; 2.66 1t 74 ; 2.88542 1t 0 ; 3 1t 76 ; 3.85938 1t 0 ; 4.66 1t 80 ; 4.83854 1t 0 "
]
}
]
},
{
"groove": "JazzBasieFillAA",
"description": "1 bar fill AA.",
Expand Down
2 changes: 1 addition & 1 deletion build/mma.sef.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/musicxml.sef.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/timemap.sef.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/unroll.sef.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion mma
Submodule mma updated 1 files
+3 −2 MMA/docs.py
Loading

0 comments on commit 7df28ea

Please sign in to comment.