HeartMuLa

HeartCodec: music in 12.5 tokens a second

A music codec developed in-house by HeartMuLa. Its encoder turns a song into compact tokens, and its decoder turns them back into 48 kHz stereo audio. It is how the HeartMuLa song models make sound.

Open encoder and decoder under Apache-2.0.

Which HeartCodec release do you need?

The two HeartCodec repositories on Hugging Face
HeartCodec-oss-20260123decoderHeartCodec-oss-encoderencoder
What it containsThe decoder and the shared quantizer: tokens back into audioThe encoder only: audio into tokens
InputHeartCodec tokens: 8 streams at 12.5 HzMono or stereo audio, any sample rate
Output48 kHz stereo audio8 token streams at 12.5 Hz
Use it withThe open HeartMuLa song models, or the encoder for reconstructionThe HeartCodec-oss-20260123 decoder; the two only work together
LicenseApache-2.0Apache-2.0

What is HeartCodec?

HeartCodec is the music codec of the HeartMuLa family. Its encoder turns a mono or stereo recording into eight streams of discrete tokens at 12.5 frames a second, and its decoder turns those tokens back into 48 kHz stereo audio.

The low frame rate is the point: a whole song stays short enough, in tokens, for a language model to generate it, while the codec keeps the timbre and the structure of the music. The HeartMuLa song models generate HeartCodec tokens, and HeartCodec decodes them into the song you hear. The paper HeartMuLa: A Family of Open Sourced Music Foundation Models explains the design.

The decoder release of 23 January 2026 improved decoding quality over the first HeartCodec release of 14 January; the encoder is published separately and works only with that decoder.

HeartCodec-oss-20260123 on Hugging FaceHeartCodec-oss-encoder on Hugging Faceheartlib on GitHubPaper: HeartMuLa: A Family of Open Sourced Music Foundation Models

What can you do with HeartCodec?

How to use HeartCodec

Install heartlib and download both repositories. To encode a song and decode it again, run the run_music_reconstruction.py example with --encoder_path and --decoder_path. In Python, load the pair with HeartCodec.from_encoder_decoder_pretrained() and use tokenize() and detokenize(); do not pass the encoder-only repository to HeartCodec.from_pretrained().

git clone https://github.com/HeartMuLa/heartlib.git && cd heartlib && pip install -e .
hf download --local-dir ./ckpt/HeartCodec-oss HeartMuLa/HeartCodec-oss-20260123
hf download HeartMuLa/HeartCodec-oss-encoder

Explore related models

Questions about HeartCodec

What does HeartCodec do?

It turns audio into discrete tokens and back. The encoder makes eight token streams at 12.5 frames a second from mono or stereo audio; the decoder turns them into 48 kHz stereo audio.

Why 12.5 Hz?

Few tokens per second keep a whole song short enough for a language model to generate, while the codec keeps the timbre and structure of the music.

Which files do I need?

HeartCodec-oss-20260123 (the decoder and quantizer) to turn tokens into audio. Add HeartCodec-oss-encoder to turn audio into tokens; the encoder only works with that decoder.

Is HeartCodec free for commercial use?

Yes. The weights and the heartlib code are released under Apache-2.0.

Updated:

Encode and decode music with HeartCodec.

Get HeartCodec on Hugging Face