npm.io
1.3.3 • Published 2 weeks ago

@audio/decode-flac

Licence
MIT
Version
1.3.3
Deps
2
Size
148 kB
Vulns
0
Weekly
0
Stars
208

@audio/decode-flac

Decode raw FLAC and Ogg FLAC audio with @wasm-audio-decoders/flac.

import decode, { decoder } from '@audio/decode-flac'

let { channelData, sampleRate } = await decode(flacBytes)

let dec = await decoder() // initialize WASM
let a = dec.decode(chunk1)
let b = dec.decode(chunk2)
let tail = dec.flush()
dec.free()

decoder() initializes asynchronously. decode() and flush() are synchronous. decode() accepts consecutive raw FLAC and complete Ogg FLAC files. Raw FLAC may omit the STREAMINFO sample total. For chunked input, flush() ends the decoder.

License

· MIT

Keywords