AUDIO
Source snapshot · 12 October 2026

WAV/AIFF streams and audio handoff buffers

Incremental lossless FLAC output

Optional FlacWriter<W: Write + Seek> accepts an explicitly empty destination, format, total frame limit 1..2^36-1 (fitting usize) and encoded byte budget at least 42. It retains one 4096-frame interleaved block and one backend frame buffer; serialization is capped at 256 KiB per frame. Backend working allocations and CPU time remain its contract. It does not accumulate earlier audio frames.

write_frames accepts at most 65536 whole interleaved signed PCM16/24 frames per call. Empty writes do nothing. Invalid shapes/ranges/input capacity preserve pending samples, output and digest. Full blocks emit immediately; only finish emits a short final block and rewrites STREAMINFO count/MD5/block/frame bounds, then flushes and returns the sink positioned at its end. Empty recordings reject. Drop does not finalize. Consumers own file creation, worker scheduling and errors.

Encoding, output budget or I/O errors after acceptance poison the writer; a file may retain a complete or partial prefix. Further writes/finalization reject. accepted_frames includes the retained/failed-call accepted prefix; written_bytes excludes a potentially partial failed write. Finishing consumes the writer and cannot retry a header/seek/flush failure. No float quantization, implicit device/ring integration or physical recording support is implied.

Acceptance compares differently partitioned all-channel/both-precision streams, short/full/partial blocks and extrema with exact decode; it covers rejection preservation, total/output budgets, partial-write poison and final seek/flush failures. Independent FFmpeg checks actual generated files. See decision 0074.