Decode MP3 audio with mpg123-decoder.
import decode, { decoder } from '@audio/decode-mp3'
let { channelData, sampleRate } = await decode(mp3Bytes)
let dec = await decoder() // initialize WASM
let a = dec.decode(chunk1)
let b = dec.decode(chunk2)
dec.free()
decoder() is asynchronous. Its decode() method is synchronous.
License
ॐ · MIT. decode-mp3.js bundles libmpg123, LGPL-2.1 (LICENSE.mpg123); mpg123-decoder and @wasm-audio-decoders, MIT, with puff, zlib (LICENSE.wasm-audio-decoders); simple-yenc, MIT (LICENSE.simple-yenc). Corresponding source: libmpg123, release not recorded (mpg123-decoder 1.0.3 names none and the compiled code carries no version string), from mpg123.de, compiled by mpg123-decoder 1.0.3 and bundled by build.sh.