Closed binyamin closed 5 years ago
Please try and make a minimal example to isolate the problem. I've skimmed index.js
but couldn't find any MIDI related code.
Edit: When you use buffers for MIDI file data, please print their first 64 bytes, and verify those are the bytes you expect.
Look at /src/main.js
That's where my code is.
Have you verified the first 64 buffer bytes?
Not sure what I'm looking for. I used a vs code plugin to view the midi file, and it's in hexadecimal.
00000000: 4d54 6864 0000 0006 0001 0002 01ef bfbd
00000010: 4d54 726b 0000 10ef bfbd 00ef bfbd 5804
...
For the array buffer, am I looking at the int8, int16, or int32? When I convert the hex to decimal, none of the options match up to the first number.
Somehow, it's working now. Thanks!
It was most probably a problem with your buffer handling then. I'd suggest studying more basics when you have a bit of time for it.
Not sure what I'm looking for.
Well, the error message said:
MTrk prefix not found
So take a look at your first 64 bytes of your MIDI in a reasonable hex editor that also shows an opportunistic ASCII interpretation, then the same in your buffer (e.g. console.trace(encodeURI(myBuffer.slice(0, 64).toString('binary')));
) and maybe you can spot the MTrk prefix. (The encodeURI
is to protect your terminal from control characters.)
Edit:
For the array buffer, am I looking at the int8, int16, or int32?
uint8 probably, i.e. bytes.
Issue
I'm a gentledev i:
Expected behavior
The console logs the result of
midiFile.header.getFormat();
Actual behavior
The console returns an error:
Uncaught (in promise) Error: Invalid MIDIFileTrack (0xe) : MTrk prefix not found
Steps to reproduce the behavior
Clone or download the repository here and
run npm start
.Debugging informations
node -v
result:10.14.1
npm -v
result:6.4.1
If the result is lower than 6.9.5, there is poor chances i even have a look to it. Please, use the last NodeJS LTS version.