@audio/aiff-encode
v1.0.0
Published
Encode PCM audio samples to AIFF format
Readme
@audio/aiff-encode
Encode PCM audio samples to AIFF format. Pure JS — no WASM, no native bindings, works in both node and browser.
import aiff from '@audio/aiff-encode';
const encoder = await aiff({ sampleRate: 44100 });
encoder.encode(channelData); // buffer PCM
const buffer = encoder.flush(); // → complete AIFF file as Uint8ArrayOptions
| Option | Default | Description |
|--------|---------|-------------|
| sampleRate | — | Sample rate (required) |
| bitDepth | 16 | 16 or 24 |
Streaming
const encoder = await aiff({ sampleRate: 48000, bitDepth: 24 });
encoder.encode(chunk1);
encoder.encode(chunk2);
const file = encoder.flush(); // → Uint8Array (complete AIFF)
encoder.free();Input is Float32Array[] — one array per channel. Big-endian interleaving handled automatically.
License
ॐ

