Skip to content

Latest commit

 

History

History

README.md

@audio/decode-opus

Decode Ogg Opus audio to PCM samples with libopus WASM.

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

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

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

decoder() is asynchronous. Its decode() and flush() methods are synchronous. flush() ends the stream.

Metadata

Read OpusTags 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 }

License

ॐ · MIT. Bundled libopus is BSD 3-Clause.