Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible midi encode bug #57

Closed
zfan40 opened this issue May 10, 2018 · 1 comment
Closed

Possible midi encode bug #57

zfan40 opened this issue May 10, 2018 · 1 comment

Comments

@zfan40
Copy link

zfan40 commented May 10, 2018

I'm using MidiConvert on client side, and export is done with blobs.
Generally it's working fine, but I came up with this minimal example that show the issue.
midi
.track()
.patch(32)
.note(76, 0, 0.66666)
.note(46, 0, 0.66666)
.note(50, 0, 2)
.note(76, 0.66666, 0.66666)
.note(76, 1.33333, 0.66666);
this example will lead to an midi file with length more than 2seconds, and the rhythm is not correct as shown below.
I am curious if this bug will reproduce on server side.
here is the full code
const midi = MidiConvert.create()
midi.track().patch(32).note(76, 0, 0.66666).note(46, 0, 0.66666).note(50, 0, 2).note(76, 0.66666, 0.66666).note(76, 1.33333, 0.66666);
const binaryString = midi.encode();
const bytes = new Uint8Array(binaryString.length);
for (let i = 0; i < binaryString.length; i++) { bytes[i] = binaryString.charCodeAt(i); }
var blob = new Blob([bytes], { type: "audio/midi;charset=binary" });
FileSaver.saveAs(blob, "output.mid");
image

@zfan40
Copy link
Author

zfan40 commented May 10, 2018

more structured note sequence works fine for me, but not this one.
if it's not clear, it's the second midi76 and third midi76 in the wrong place...

@tambien tambien closed this as completed Feb 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants