Skip to content

Commit

Permalink
Allow overlapping notes
Browse files Browse the repository at this point in the history
  • Loading branch information
infojunkie committed Sep 24, 2024
1 parent 5849d86 commit f9a05e3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/js/musicxml-grooves.js
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ function quantizeNoteOnset(note, index, notes, beats, grid) {
if (onset !== undefined) {
return onset
}
if (isFirstNote || notes[index-1].quantized.onset < candidate.multiple) {
if (isFirstNote || notes[index-1].quantized.onset <= candidate.multiple) {
return candidate
}
}, undefined)
Expand Down Expand Up @@ -620,7 +620,7 @@ function quantizeNoteDuration(note, index, notes, beats, grid) {
const isLastNote = index === notes.length - 1 || notes[index+1].voice !== note.voice
const scoreOffset = Math.min(
note.quantized.onset + note.quantized.duration,
isLastNote ? beats * DIVISIONS : notes[index+1].quantized.onset
isLastNote ? beats * DIVISIONS : notes[index+1].quantized.onset + (notes[index+1].quantized.onset === note.quantized.onset ? notes[index+1].quantized.onset : 0)
)
let offset = grid.map(unit => {
return nearestMultiple(scoreOffset, DIVISIONS/unit)
Expand Down

0 comments on commit f9a05e3

Please sign in to comment.