LARA-Gen: Dial Music Emotion by Number, Weights Out

Introduction
The team behind LARA-Gen just put its weights on Hugging Face. LARA-Gen is a music generation model from Shanghai Jiao Tong University's X-LANCE Lab, working with Shanghai AI Lab and Shanghai Mental Health Center. You don't describe the mood in words. You give it two numbers. The LSM571/LARA-Gen repo went up on November 8. It's uploaded by co-author Shimeng Li and contains the main checkpoint from the paper plus a small inference package.
The paper, LARA-Gen: Enabling Continuous Emotion Control for Music Generation Models via Latent Affective Representation Alignment, came out in October 2025. Until today, all you could do was read about it and listen to samples on the project page. Now you can run it yourself.
Why it's interesting for music makers
Mood words are a blunt tool. "Relaxed" and "calm" might sound nearly the same to a model, and "a little tense but hopeful" is hard to say in a prompt at all. LARA-Gen swaps the words for two sliders from emotion research:
- Arousal (1 to 9) is energy, from sleepy to intense.
- Valence (1 to 9) is pleasantness, from dark and sad to bright and happy.
Because both are continuous, you can move in small steps. Picture a game level that slowly gets tenser, or a meditation track that drifts from 3.0 to 2.2 arousal. On the project page, the authors compare it with a version fine-tuned on emotion words from the ANEW mood-word list, using value pairs such as valence 6.2 and arousal 2.1 against the word "relaxed."
The trick behind it is the "LARA" part. During training, a small proxy network lines up the model's hidden states with features from a frozen MERT music-understanding encoder. The authors also built an Emotion Predictor and a held-out test set so they could score how well the output actually hits the target values.
What's in the release
- Base model: fine-tuned from facebook/musicgen-medium.
model.safetensorsis about 3.7 GB, and a smallav_encoder.safetensors(under 1 MB) handles the arousal and valence conditioning. You need both files. - Output: instrumental audio, mono, 32 kHz, loudness-normalized WAV. The default length is 30 seconds, and
--durationaccepts 0.5 to 30 seconds. Each render writes a JSON sidecar with its inputs and seed. - Frozen parts: T5-base and EnCodec 32 kHz download from their original repos on first run, at pinned revisions.
- License: the weights are CC BY-NC 4.0, inherited from MusicGen, so they're for non-commercial use only. The code is MIT.
Run it
The authors validated it on Python 3.9 or 3.10 with PyTorch 2.1.1, and ran a full 30-second generation on an A100. CUDA is recommended. --device cpu works, but it's slow. You also need FFmpeg installed.
hf download LSM571/LARA-Gen --local-dir LARA-Gen && cd LARA-Gen
python -m pip install -r requirements.txt
python generate.py --arousal 7.4 --valence 5.8 --seed 204000 --output outputs/example.wavOr call it from Python:
from laragen import LaraGen
model = LaraGen('.', device='cuda')
audio = model.generate(arousal=7.4, valence=5.8, seed=204000)To try an emotion sweep, keep the seed fixed and change one value at a time, for example arousal 2, 4, 6 and 8 at valence 5. That's the quickest way to hear what the dial really does. The paper samples use seeds 204000 plus the sample index.
Honest caveats
generate.pytakes arousal, valence, duration and seed. It has no genre or instrument prompt. The internal text prompt is a fixed instrumental template (the authors kept their original typo, "Genarate"), so you're steering feeling, not style.- It's MusicGen-medium underneath, so expect 2023-era MusicGen sound quality. Don't expect today's full-song models, and there are no vocals or lyrics.
- The emotion-adherence results come from the authors' own paper and benchmark.
- Because the weights are NC-licensed, you can't use the clips in paid client work or monetized releases.
Conclusion
If you've ever wanted a "make it 20% sadder" knob for background music, this is a fun research toy to try this weekend. It could also be a handy base for adaptive game or film-temp scores.
—Anabel ♡
