/** * FLAC encoder. * * Lossless, so the goal is purely "how small, how fast". Three stages decide * that, and each is a search over a small space: * * 1. **Channel decorrelation** — a stereo pair is usually far more compressible * as mid/side than as left/right, because the side channel is near-silent on * centred material. All four modes are tried and the cheapest wins. * 2. **Prediction** — fixed polynomial predictors (orders 0–4) plus, at higher * compression levels, LPC coefficients solved per block via Levinson-Durbin. * Whichever leaves the smallest residual wins. * 3. **Rice coding** — the residual is split into partitions, each with its own * optimal Rice parameter, so a block containing both quiet and loud passages * does not pay the loud passage's parameter throughout. * * Output is verified byte-for-byte decodable by the reference `flac` tool in the * interop tests, and STREAMINFO carries a real MD5 so `flac -t` passes. */ import type { Audio } from '../audio.js'; import type { AudioMetadata } from '../types.js'; export interface FlacEncodeOptions { /** * 0–8, mirroring the reference encoder's scale. Higher is smaller and slower. * Defaults to 5, the same default `flac` itself uses. * * 0–2 use fixed predictors only; 3+ additionally search LPC orders. */ compressionLevel?: number; /** Bit depth to store. 16 or 24. Defaults to 16. */ bitDepth?: 8 | 16 | 24; /** Tags to embed as a Vorbis comment block. */ metadata?: AudioMetadata; } /** Encodes audio as a FLAC stream. */ export declare function encodeFlac(audio: Audio, options?: FlacEncodeOptions): Uint8Array;