Skip to content

audiojs/audio-decode

Repository files navigation

audio-decode test stable

Decode audio data from supported format to AudioBuffer.

Supported formats:

  • wav
  • mp3
  • ogg vorbis
  • flac
  • opus
  • alac
  • aac
  • m4a
  • qoa

npm install audio-decode

import decodeAudio from 'audio-decode';
import buffer from 'audio-lena/mp3';

let audioBuffer = await decode(buffer);

buffer type can be: ArrayBuffer, Uint8Array or Buffer.

decode is lazy: first call prepares decoder.

To get more granular control over individual decoders, use decoders:

import decode, {decoders} from 'audio-decode';

await decoders.mp3(); // load & compile decoder
const audioBuffer = await decoders.mp3(mp3buf); // decode

See also

License

MIT  •  🕉