Closed prem2282 closed 5 years ago
I see that the MIDIFile.js takes input as array buffer. But I am puzzled about how to read a midi file and get the arraybuffer out of it? I know it is out of the context here. But I am new and need some help.
How to obtain file contents as an ArrayBuffer in a web browser is independent from the file type and thus indeed (as you know and wrote) not a MIDI problem.
My first search attempt (you can probably do better) was for "browser read file as arraybuffer" and some of the results I found (you can probably find more/better ones) were
https://developer.mozilla.org/en-US/docs/Web/API/FileReader/readAsArrayBuffer
(reading from a folder; for reading from URL, try the fetch
API)
and
https://github.com/dcodeIO/ProtoBuf.js/wiki/How-to-read-binary-data-in-the-browser-or-under-node.js%3F
If those don't help, and neither any you can find yourself, please ask that question in a more general JavaScript help forum.
How to find at what stage your problem really is about MIDI: Open your MIDI file in a hex editor, look at the first 8 bytes. Print the first 8 bytes of your ArrayBuffer as hex in the browser console. If they're the same, then you've probably mastered the file transfer stuff and any remainig problem might be about MIDI.
Issue
I'm a gentledev i:
Expected behavior
Actual behavior
Steps to reproduce the behavior
Debugging informations
node -v
result:npm -v
result: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.
Feature request
Feature description
Use cases