audioJS

@audio/decode-opus

Status calibrated

npm1.3.3licenseMIT

Decode Ogg Opus audio with local libopus WASM

Overview

Install
Updated
Family
decode, 25 packages under it

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.