# @audio/decode-caf

> Decode CAF (Core Audio Format) audio to PCM samples

Latest version **1.4.0** (published 2026-08-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install @audio/decode-caf
pnpm add @audio/decode-caf
yarn add @audio/decode-caf
bun add @audio/decode-caf
```

## Health

**Score 70/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; recently updated; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 1.4.0 |
| Published | 2026-08-11 |
| First published | 2026-04-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=18 |
| Dependencies | 0 |
| Unpacked size | 14 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 208 |
| Author | audiojs |
| Maintainers | jamen, dfcreative, dy |
| Keywords | caf, core-audio, apple, audio, decode, decoder, pcm |

## Links

- npm: https://www.npmjs.com/package/@audio/decode-caf
- Repository: https://github.com/audiojs/decode
- Homepage: https://github.com/audiojs/decode/tree/master/packages/decode-caf#readme
- Issues: https://github.com/audiojs/decode/issues
- Funding: https://github.com/sponsors/audiojs
- npm.io page: https://npm.io/package/@audio/decode-caf

## Alternatives

- [flatbuffers](https://npm.io/package/flatbuffers.md) — 6.0M weekly downloads
- [jwt-simple](https://npm.io/package/jwt-simple.md) — 259.5K weekly downloads
- [@exodus/patch-broken-hermes-typed-arrays](https://npm.io/package/@exodus/patch-broken-hermes-typed-arrays.md) — 28.5K weekly downloads
- [@native-to-anchor/buffer-layout](https://npm.io/package/@native-to-anchor/buffer-layout.md) — 12.2K weekly downloads
- [binary-parser-encoder](https://npm.io/package/binary-parser-encoder.md) — 5.3K weekly downloads

## Recent versions

- 1.4.0 (latest) — 2026-08-11
- 1.3.3 — 2026-07-14
- 1.3.2 — 2026-07-11
- 1.3.1 — 2026-07-10
- 1.3.0 — 2026-07-10
- 1.2.1 — 2026-07-09
- 1.2.0 — 2026-06-22
- 1.1.2 — 2026-06-22
- 1.1.1 — 2026-04-11
- 1.1.0 — 2026-04-05
- 1.0.0 — 2026-04-04

## README

# @audio/decode-caf

Decode Core Audio Format audio to PCM float samples.

## Install

```
npm i @audio/decode-caf
```

## Usage

```js
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

[ॐ](https://github.com/krishnized/license/) · [MIT](./LICENSE)

---
_Source: https://npm.io/package/@audio/decode-caf · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
