mwg API
    Preparing search index...

    Function webAudioSampleDecoder

    • A decoder over WebAudio's decodeAudioData, for a browser: each sample decodes in a context created at the sample's own rate, so the browser does not resample it and the loop points keep meaning what the font wrote. A rate outside what a context accepts (8 to 96 kHz) decodes at the nearest accepted rate and is resampled back. create replaces the context factory and limits the longest sample it will return.

      Parameters

      Returns SoundFontSampleDecoder

      import { loadSoundFont, webAudioSampleDecoder } from '@datamoc/mwg/audio';

      declare const sf3Bytes: ArrayBuffer;

      const font = await loadSoundFont(sf3Bytes, { decode: webAudioSampleDecoder() });
      console.log(font.presetCount);