vlac: A lossless audio codec for voice, written in Rust
I built vlac, a lossless audio codec designed specifically for 16kHz mono voice audio. It uses an Order-4 LPC predictor and Zstandard with trained dictionaries.
It's written in Rust for memory safety.
How it works
- Predict the next sample using the previous three.
- ZigZag encode the residuals.
- Split the residuals into High and Low bytes (so Zstandard can compress the zero-padded High bytes efficiently).
- Compress with Zstandard.
Benchmarks
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. The architecture allows for domain-specific dictionary training, which FLAC cannot do.
Top comments (0)