abcjs
abcjs copied to clipboard
Allow the user to customize getNote() function
Hi Paul.
Thank you for this nice library. I have used it for my personal music note-taking app.
However, the 6+ version of the library is no longer compatible with the old sound font format for midi.js, which is quite an inconvenience. To solve the compatibility problem, we should allow the user to load the sound font on their own. We can keep the original getNote() function as the default loader.
I am surprised by this - I thought it was compatible. What error are you seeing?
File not found.
The new loader only accepts raw mp3 audio with the path being soundfontpath/instrumentname-mp3/notename.mp3. Midi.js can also load packed mp3/ogg files like instrumentname-mp3.js and instrumentname-ogg.js. You can see these files in gleitz's repo.
So, would you like an option for the user to replace getNote, so that you pass in a function to use instead?
This would be good.
Actually, I think the user should set this function at config.soundfont. This value can either be a string (sound font path), a normal function or a function returning a promise.