mwg API
    Preparing search index...

    Function mergeSoundFonts

    • Joins several SoundFont 2 files into one, presets in the order given. When two files carry the same (bank, program) the first wins and the other's preset, instruments and samples are dropped, so the result never holds a voice nothing can reach. This is how single-instrument files (a per-program font collection) become the one file a game ships; subsetSoundFont then trims it like any other.

      Parameters

      • fonts: readonly (ArrayBuffer | ArrayBufferView<ArrayBufferLike>)[]

      Returns ArrayBuffer

      import { mergeSoundFonts, parseSoundFont } from '@datamoc/mwg/audio';

      declare const pianoBytes: ArrayBuffer;
      declare const drumsBytes: ArrayBuffer;

      const merged = mergeSoundFonts([pianoBytes, drumsBytes]);
      console.log(parseSoundFont(merged).presetCount);