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?
| HeartCodec-oss-20260123decoder | HeartCodec-oss-encoderencoder | |
|---|---|---|
| What it contains | The decoder and the shared quantizer: tokens back into audio | The encoder only: audio into tokens |
| Input | HeartCodec tokens: 8 streams at 12.5 Hz | Mono or stereo audio, any sample rate |
| Output | 48 kHz stereo audio | 8 token streams at 12.5 Hz |
| Use it with | The open HeartMuLa song models, or the encoder for reconstruction | The HeartCodec-oss-20260123 decoder; the two only work together |
| License | Apache-2.0 | Apache-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?
Turn HeartMuLa’s tokens into audio
Every song the open song models generate goes through the decoder.
Tokenize music for your own model
Encode audio into 8 streams at 12.5 Hz, a compact input for sequence models.
Test reconstruction
Encode a song and decode it again to hear what the codec keeps.
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-encoderExplore related models
HeartMuLa-RL
The open 3B song model, refined with reinforcement learning to follow styles and tags more closely.
HeartMuLa v1
Turns your lyrics or a short description into a full song with vocals, up to 6 minutes long.
HeartTranscriptor
Transcribes the lyrics sung in a song into text.
All HeartMuLa models
Song generation, covers, transcription and audio encoding.
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: