vlac: A lossless audio codec for voice, written in Rust
Description and use
vlac is a lossless codec for 16 kHz mono voice audio, written in Rust, using an Order‑4 LPC predictor and Zstandard with trained dictionaries. It guarantees 100 % bit‑perfect output, compiles to WebAssembly, and supports domain‑specific dictionary training, producing files 8 % larger than FLAC on general voice audio.
Problem
Need a lossless codec that preserves 16kHz mono voice audio with domain‑specific compression and WebAssembly support.
Outcome
vlac achieves 8 % larger files than FLAC on general voice audio but guarantees bit‑perfect output and supports domain‑specific dictionary training and WebAssembly compilation.
Workflow
- Predict next sample using previous three samples (Order‑4 LPC).
- ZigZag encode the residuals.
- Split residuals into High and Low bytes for efficient Zstandard compression of zero‑padded High bytes.
- Compress the split residuals with Zstandard using trained dictionaries.
Evidence
I built vlac, a lossless audio codec designed specifically for 16kHz mono voice audio.
On a 10.75-second voice memo (337 KB WAV): Original WAV: 337 KB, FLAC (ffmpeg default): 151 KB, vlac: 163 KB
vlac currently produces files 8% larger than FLAC on general voice audio. However, it is 100% bit-perfect (verified via MD5 hash on the raw PCM data) and compiles to WebAssembly.
- Record date: 2026-10-21T11:41:28.347Z