Neural Audio Codecs (NACs) compress a waveform into a sequence of discrete tokens using a neural encoder and residual vector quantization (RVQ). These tokens are the bridge between raw audio and language models: once audio is tokenized, standard autoregressive Transformers can generate, enhance, or edit speech.

The key design tradeoffs are token rate (tokens/sec), number of codebooks, and reconstruction quality. High token rate (DAC: 801 tok/sec) means high quality but long sequences — expensive for autoregressive modeling. Low token rate (WavTokenizer: 40–75 tok/sec) means shorter sequences but potential quality loss, especially on degraded audio. SNAC and X-Codec2 hit a practical middle ground for most speech tasks.

Choosing the right codec significantly impacts model memory footprint, training speed, and output quality.

X-Codec2 setup and usage — single-codebook codec used by Llasa for TTS. Stable version is 1.3.0.
Oct 2025
WavTokenizer setup — extreme compression (40–75 tok/sec, single codebook). Best for clean TTS; avoid for noisy/degraded speech.
Oct 2025
SNAC setup and encode/decode wrapper — matches DAC quality at significantly lower token rate via multi-scale residual vector quantization.
Oct 2025
DAC setup and a wrapper class for encoding/decoding audio as flattened token sequences — time-major and codebook-major layouts.
Oct 2025
Side-by-side comparison of DAC, SNAC, WavTokenizer, and X-Codec2 — token rates, codebook counts, and when to use each.
Oct 2025