mwg API
    Preparing search index...

    Function resolveMidiSynth

    • Walks a request in order and settles on the first engine that works: a registered name is looked up, a factory is called, an internal name ends the walk. An unknown name, a factory that throws or a synth with a bad shape is skipped, and when something other than the first choice ends up voicing the file onMidiSynthFallback says so. Never throws: running out of choices lands on the internal path.

      Parameters

      • request: MidiSynthRequest
      • sampleRate: number
      • internalName: "gm-soundfont" | "builtin"

      Returns ResolvedMidiSynth

      import { resolveMidiSynth } from '@datamoc/mwg/audio';

      const { synth, name } = resolveMidiSynth(['retro:mt32', 'retro:opl2'], 44100, 'gm-soundfont');
      console.log(name, synth === null ? 'internal path' : synth.sampleRate);