gleitz / midi-js-soundfonts

Pre-rendered General MIDI soundfonts that can be used immediately with MIDI.js
http://blog.gleitzman.com/post/63283830260/midi-js-playing-audio-in-the-browser-with-javascript
MIT License
674 stars 148 forks source link

Where in the code is `MIDI.Soundfont` being filled? #42

Open page200 opened 1 year ago

page200 commented 1 year ago

When loading a MIDI file, I'd like to load only the audio for the notes that will play in that file, rather than also all other notes in the SoundFont for that instrument. The goal is to save loading time, internet traffic, and RAM.

Could you please give me a hint where in the code the global variable MIDI.Soundfont gets set?

(I tried various things to find that out. I didn't find it by searching the code. When I step through the code in debug mode, MIDI.Soundfont doesn't get updated, maybe because the code notices the slowness of my stepping and has a mechanic of giving up when some steps take too long. Surprisingly, debugPropertySet(MIDI, "Soundfont") from https://github.com/mattzeunert/javascript-breakpoint-collection doesn't get triggered by changes of MIDI.Soundfont. A Watch of MIDI.Soundfont in Chrome Developer Tools doesn't trigger a breakpoint and shows an outdated value of MIDI.Soundfont.)

gleitz commented 1 year ago

You may want to post in the main MIDI.js repo - this is just a repo for soundfonts.