import { missingSoundFontPrograms, parseMidi, collectSoundFontUsage } from '@datamoc/mwg/audio';
declare const soundfontBytes: ArrayBuffer;
declare const midiBytes: ArrayBuffer;
const usage = collectSoundFontUsage([parseMidi(midiBytes)]);
for (const { bank, program } of missingSoundFontPrograms(soundfontBytes, usage)) {
console.log(`bank ${bank} program ${program} is not in the font`);
}
The programs of
usagethe font does not carry, so a game can tell at build time which of the instruments its MIDI files ask for would be missing. A bank without the program counts as carried when bank 0 has it (the fallback every player makes), a drum kit only when the font has that exact kit. What plays for a missing one is themissingProgrampolicy ofparseSoundFont. Works on a SoundFont 2 or 3.