Package Exports
- audio-decode
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (audio-decode) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
audio-decode

Convert mp3/wav audio data to AudioBuffer.
const decode = require('audio-decode');
const buffer = require('audio-lena/mp3');
//as a callback
decode(buffer, (err, audioBuffer) => {});
//as a promise
decode(buffer).then(audioBuffer => {}, err => {});API
let promise = decode(source, {context}?, (err, audioBuffer)=>{}?)
Decode source, based on options and fire callback when done, or resolve a promise if no callback passed. Source type can be: ArrayBuffer, ArrayBufferView, Buffer, Blob, File or data-uri string.
options may include context property for web-audio-api context (browser-only). By default new audio-context is created.
Supported formats
Browser version uses decodeAudioData method, in node the aurora is used.
Shipped by default:
- wav via wav-decoder
- mp3 via aurora mp3
To enable additional format, install it as a dependency npm install --save flac.js and require once require('flac.js').
Additional formats available:
- flac via flac.js
- alac via alac.js
- aac via aac.js
- vorbis via vorbis.js
- ogg via ogg.js
- opus via opus.js
Credits
- @mohayonao for wav-decoder.
- @devongovett and @jensnockert for aurora.js.
- @jamen as originator of this package.
Related
- context.decodeAudioData web-audio-api
