Skip to content

Commit 94b7235

Browse files
authored
Merge pull request #4 from jouae/fix/web
Add zero-duration note handling in web app
2 parents 3c3868f + 8443a23 commit 94b7235

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

web/app.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,13 +312,13 @@ function parseMidiFile(buffer) {
312312
active.set(evt.note, evt.time);
313313
} else {
314314
const start = active.get(evt.note);
315-
if (start !== undefined) {
315+
if (start !== undefined && evt.time >= start) {
316316
const duration = evt.time - start;
317317
const beatVal = Math.max(1, Math.round(duration * 4 / ticksPerBeat));
318318
notes.push(evt.note);
319319
beats.push(beatVal);
320-
active.delete(evt.note);
321320
}
321+
active.delete(evt.note);
322322
}
323323
}
324324

0 commit comments

Comments
 (0)