A collection of audio codecs with a standardized API for easy integration and benchmarking.
- BigCodec
- DAC
- EnCodec
- EnCodec + Vocos
- FocalCodec
- Mimi
- SemantiCodec
- SpeechTokenizer
- Stable Codec
- WavLM k-means
- WavTokenizer
First of all, install Python 3.8 or later.
Then, clone or download and extract the repository and navigate to <path-to-repository>
.
To install the package locally in editable mode, without codecs (which must be installed separately), open a terminal and run:
pip install -e .
To install all available codecs, run:
pip install -e .[all]
To check the reconstruction quality of a codec, navigate to the <path-to-repository>/audiocodecs
directory and run:
python <codec-name>.py
This will generate a file named reconstruction.wav
corresponding to example.wav
in the same directory.
To use one of the available codecs in your script (for example EnCodec):
import torchaudio
from audiocodecs import Encodec
audio_file = "audiocodecs/example.wav"
sig, sample_rate = torchaudio.load(audio_file)
model = Encodec(sample_rate=sample_rate, orig_sample_rate=24000, num_codebooks=8)
model.requires_grad_(False).eval()
toks = model.sig_to_toks(sig)
rec_sig = model.toks_to_sig(toks)
torchaudio.save("reconstruction.wav", rec_sig, sample_rate)
Reference implementations of downstream tasks using these audio codecs can be found in the downstream
directory.
@article{dellalibera2025focalcodec,
title = {{FocalCodec}: Low-Bitrate Speech Coding via Focal Modulation Networks},
author = {Luca {Della Libera} and Francesco Paissan and Cem Subakan and Mirco Ravanelli},
journal = {arXiv preprint arXiv:2502.04465},
year = {2025},
}
@article{speechbrainV1,
title = {Open-Source Conversational {AI} with {SpeechBrain} 1.0},
author = {Mirco Ravanelli and Titouan Parcollet and Adel Moumen and Sylvain de Langen and Cem Subakan
and Peter Plantinga and Yingzhi Wang and Pooneh Mousavi and Luca {Della Libera} and Artem Ploujnikov
and Francesco Paissan and Davide Borra and Salah Zaiem and Zeyu Zhao and Shucong Zhang
and Georgios Karakasidis and Sung-Lin Yeh and Pierre Champion and Aku Rouhe and Rudolf Braun
and Florian Mai and Juan Zuluaga-Gomez and Seyed Mahed Mousavi and Andreas Nautsch and Ha Nguyen
and Xuechen Liu and Sangeet Sagar and Jarod Duret and Salima Mdhaffar and Ga{{\"e}}lle Laperri{{\`e}}re
and Mickael Rouvier and Renato De Mori and Yannick Est{{\`e}}ve},
journal = {Journal of Machine Learning Research (JMLR)},
year = {2024},
volume = {25},
number = {333},
pages = {1--11},
}
@article{ravanelli2021speechbrain,
title = {{SpeechBrain}: A General-Purpose Speech Toolkit},
author = {Mirco Ravanelli and Titouan Parcollet and Peter Plantinga and Aku Rouhe and Samuele Cornell
and Loren Lugosch and Cem Subakan and Nauman Dawalatabad and Abdelwahab Heba and Jianyuan Zhong
and Ju-Chieh Chou and Sung-Lin Yeh and Szu-Wei Fu and Chien-Feng Liao and Elena Rastorgueva
and François Grondin and William Aris and Hwidong Na and Yan Gao and Renato De Mori and Yoshua Bengio},
journal = {arXiv preprint arXiv:2106.04624},
year = {2021},
}