npm.io
1.4.0 • Published 2 weeks ago

@audio/decode-caf

Licence
MIT
Version
1.4.0
Deps
0
Size
14 kB
Vulns
0
Weekly
0
Stars
208

@audio/decode-caf

Decode Core Audio Format audio to PCM float samples.

Install

npm i @audio/decode-caf

Usage

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

let { channelData, sampleRate } = decode(cafBytes)

let dec = decoder()
let result = dec.decode(chunk)
dec.free()

decode() and decoder() are synchronous.

API

decode(src): AudioData

Decode a complete Uint8Array or ArrayBuffer.

decoder(): CAFDecoder

Create a decoder instance.

  • dec.decode(data): decode a chunk.
  • dec.flush(): discard buffered partial data and return an empty result.
  • dec.free(): release resources.

Formats

  • lpcm: 8, 16, 24, and 32-bit signed integer; 32 and 64-bit float; little-endian or big-endian.
  • alaw: G.711 A-law.
  • ulaw: G.711 µ-law.
  • ima4: IMA/QuickTime ADPCM.

License

· MIT

Keywords