MagiCodec: Simple Masked Gaussian-Injected Codec for High-Fidelity Reconstruction and Generation

Yakun Song, Jiawei Chen, Xiaobin Zhuang, Chenpeng Du, Ziyang Ma +7 more
5/31/2025
9 citations
cs.SDcs.AIcs.LG

Official code: Ereboas/MagiCodec (130 stars, Python, MIT, PyTorch, last commit 2025-06-04).

Abstract

Neural audio codecs have made significant strides in efficiently mapping raw audio waveforms into discrete token representations, which are foundational for contemporary audio generative models. However, most existing codecs are optimized primarily for reconstruction quality, often at the expense of the downstream modelability of the encoded tokens.

Show full abstract

Motivated by the need to overcome this bottleneck, we introduce $\textbf{MagiCodec}$, a novel single-layer, streaming Transformer-based audio codec. MagiCodec is designed with a multistage training pipeline that incorporates Gaussian noise injection and latent regularization, explicitly targeting the enhancement of semantic expressiveness in the generated codes while preserving high reconstruction fidelity. We analytically derive the effect of noise injection in the frequency domain, demonstrating its efficacy in attenuating high-frequency components and fostering robust tokenization. Extensive experimental evaluations show that MagiCodec surpasses state-of-the-art codecs in both reconstruction quality and downstream tasks. Notably, the tokens produced by MagiCodec exhibit Zipf-like distributions, as observed in natural languages, thereby improving compatibility with language-model-based generative architectures. The code and pre-trained models are available at https://github.com/Ereboas/MagiCodec.

View on arXivView PDF

Code Implementations(1)

Ereboas/MagiCodecOfficial100%
PyTorchMIT

A single-layer, streaming codec model providing SOTA audio quality and discrete tokens designed for superior downstream modelability.

1307PythonMay 29, 20251 years agoMIT
codecllmllmspytorchspeech-language-model+3 more

Similar Papers

Cite this paper

@article{song2025magicodec,
  title  = {MagiCodec: Simple Masked Gaussian-Injected Codec for High-Fidelity Reconstruction and Generation},
  author = {Yakun Song and Jiawei Chen and Xiaobin Zhuang and Chenpeng Du and Ziyang Ma and Jian Wu and Jian Cong and Dongya Jia and Zhuo Chen and Yuping Wang and Yuxuan Wang and Xie Chen},
  year   = {2025},
  eprint = {2506.00385},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2506.00385v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2506.00385.svg)](https://codeofpaper.com/paper/2506.00385)

Discussion