Skip to content

Commit

Permalink
More enhancements to #51
Browse files Browse the repository at this point in the history
  • Loading branch information
infojunkie committed Sep 27, 2024
1 parent 00f0529 commit eef0a06
Show file tree
Hide file tree
Showing 1,800 changed files with 9,460 additions and 66,395 deletions.
2 changes: 1 addition & 1 deletion build/filter.sef.json
Original file line number Diff line number Diff line change
@@ -1 +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"}
{"N":"package","version":"10","packageVersion":"1","saxonVersion":"SaxonJS 2.6","target":"JS","targetVersion":"2","name":"TOP-LEVEL","relocatable":"true","buildDateTime":"2024-09-26T22:49:48.865-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"}],"Σ":"c55266b7"}
2 changes: 1 addition & 1 deletion build/groove.sef.json

Large diffs are not rendered by default.

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.

38 changes: 19 additions & 19 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "musicxml-midi",
"version": "2.8.1",
"version": "2.8.2",
"description": "MusicXML to MIDI converter",
"type": "module",
"directories": {
Expand Down
20 changes: 6 additions & 14 deletions src/js/musicxml-grooves.js
Original file line number Diff line number Diff line change
Expand Up @@ -605,11 +605,8 @@ function quantizeNoteOnset(note, index, notes, beats, grid) {

// Validate the quantization.
if (onset === undefined) {
console.warn(`[${note.track}:${note.measure+1}] Failed to quantize note onset at ${note.onset} to avoid collision with previous note. Moving it manually.`)
onset = {
multiple: notes[index-1].quantized.onset + DIVISIONS_1024th,
error_sgn: scoreOnset - (notes[index-1].quantized.onset + DIVISIONS_1024th)
}
console.error(`[${note.track}:${note.measure+1}] Failed to quantize note onset at ${note.onset} to avoid collision with previous note. Dropping it.`)
return
}

// Store the note.
Expand Down Expand Up @@ -644,13 +641,8 @@ function quantizeNoteDuration(note, index, notes, beats, grid) {

if (offset === undefined) {
// TODO Handle this case.
console.warn(`[${note.track}:${note.measure+1}] Failed to quantize note duration at ${note.onset} to avoid zero duration.`)
}

// Adjust the note duration if it crosses the measure boundary.
if (offset.multiple > beats * DIVISIONS) {
console.warn(`[${note.track}:${note.measure+1}] Quantized note duration at ${note.onset} crosses measure boundary. Reducing the duration.`)
offset.multiple = beats * DIVISIONS
console.warn(`[${note.track}:${note.measure+1}] Failed to quantize note duration at ${note.onset} to avoid zero duration. Dropping it.`)
return []
}

// Store the note.
Expand Down Expand Up @@ -881,8 +873,8 @@ function createNoteTiming(note, index, notes) {
// Check that the gap is all filled.
if (gap > Number.EPSILON) {
const isFirstNote = index === 0 || notes[index-1].voice !== note.voice
if (!isFirstNote && !('midi' in note)) {
console.warn(`[${note.track}:${note.measure+1}] Remaining gap of ${gap} left after rest at ${note.onset}. This indicates a missed tuplet. Attempting to fix.`)
if (!isFirstNote && !('midi' in note && notes[index-1].midi != note.midi)) {
console.warn(`[${note.track}:${note.measure+1}] Remaining gap of ${gap} left after note at ${note.onset}. This indicates a missed tuplet. Attempting to fix.`)
notes[index-1].quantized.duration += note.quantized.duration
notes[index-1].duration += note.duration
return createNoteTiming(notes[index-1], index-1, notes.toSpliced(index, 1))
Expand Down
2 changes: 1 addition & 1 deletion test/data/grooves/04JAZZ01.musicxml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<identification>
<encoding>
<software>musicxml-grooves 2.8.1</software>
<encoding-date>2024-09-25</encoding-date>
<encoding-date>2024-09-27</encoding-date>
<supports element="accidental" type="yes"/>
<supports element="beam" type="yes"/>
<supports element="print" attribute="new-page" type="yes" value="yes"/>
Expand Down
2 changes: 1 addition & 1 deletion test/data/grooves/04JAZZ02.musicxml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<identification>
<encoding>
<software>musicxml-grooves 2.8.1</software>
<encoding-date>2024-09-25</encoding-date>
<encoding-date>2024-09-27</encoding-date>
<supports element="accidental" type="yes"/>
<supports element="beam" type="yes"/>
<supports element="print" attribute="new-page" type="yes" value="yes"/>
Expand Down
2 changes: 1 addition & 1 deletion test/data/grooves/04JAZZ03.musicxml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<identification>
<encoding>
<software>musicxml-grooves 2.8.1</software>
<encoding-date>2024-09-25</encoding-date>
<encoding-date>2024-09-27</encoding-date>
<supports element="accidental" type="yes"/>
<supports element="beam" type="yes"/>
<supports element="print" attribute="new-page" type="yes" value="yes"/>
Expand Down
Loading

0 comments on commit eef0a06

Please sign in to comment.