@audio/decode-opus
v1.1.1
Published
Decode Ogg Opus audio via libopus WASM — self-contained bundle
Downloads
85,998
Readme
@audio/decode-opus
Decode Ogg Opus audio to PCM samples. Self-contained WASM bundle — no import map entries needed.
Wraps ogg-opus-decoder.
import decode, { decoder } from '@audio/decode-opus'
// whole-file
let { channelData, sampleRate } = await decode(opusbuf)
// streaming
let dec = await decoder()
let a = dec.decode(chunk1)
let b = dec.decode(chunk2)
let c = dec.flush()
dec.free()Metadata
Read OpusTags (Vorbis comment) metadata and cover art without decoding audio:
import { parseMeta } from '@audio/decode-opus/meta'
let { meta, sampleRate } = parseMeta(opusBytes)
// meta: { title, artist, album, year, genre, ..., pictures }