Replicate meta/musicgen
Text-to-music generation in ComfyUI
- input_audio
- AUDIO
Type a description of a piece of music - "upbeat 80s synthwave with a driving bassline" - and this node hands you back an audio clip of it. It's Meta's MusicGen, the text-to-music model, wrapped so you can call it from a ComfyUI graph. Great for scoring a video, prototyping a loop, or generating background music without touching a DAW. One thing worth being clear about: it makes instrumental music. No vocals, no lyrics.
And the usual Replicate caveat, because this is a Replicate node: it doesn't run locally. Your prompt goes up to Replicate's cloud, the model runs on their GPU, and the audio comes back. You need a Replicate account and a REPLICATE_API_TOKEN, and you pay per run. There's nothing to download to your machine.
How it works
MusicGen is an autoregressive transformer that generates a stream of audio tokens (via Meta's EnCodec codec) and decodes them to sound - the same next-token idea as a language model, pointed at music. The "melody" variants add a twist: you can feed in a reference audio clip and the model will generate a new arrangement that follows its melody. That's the difference between the model versions in the dropdown.
The inputs and outputs that matter
prompt- describe the music: genre, mood, instruments, tempo, era. Be concrete; "lo-fi hip hop, mellow piano, vinyl crackle, 70 bpm" beats "nice music."model_version-stereo-melody-large,stereo-large,melody-large, orlarge. Themelodyones accept aninput_audioto condition on; the plain ones are pure text-to-music.stereoversions output stereo.duration(8) - clip length in seconds. Short by default. Longer clips cost more and can meander, so generate in chunks if you want length.input_audio- a melody to follow (with a melody model), or the clip to extend whencontinuationis on.temperature(1),top_k(250),top_p(0) - sampling knobs. Lower temperature = more predictable, higher = more adventurous.
The output is a single AUDIO stream you wire into a save-audio node. output_format picks wav or mp3, multi_band_diffusion trades speed for a cleaner decode, normalization_strategy controls loudness handling, and force_rerun bypasses Replicate's cache when identical inputs would otherwise return the same clip.
How to install it
Installing the pack once gives you every Replicate node, this one included.
- ComfyUI Manager: search ComfyUI-Replicate, install, restart.
- Manual:
then restart.cd ComfyUI/custom_nodes git clone https://github.com/replicate/comfyui-replicate cd comfyui-replicate pip install -r requirements.txt
No weights to download - just the replicate pip package from requirements.txt. Set the token before you launch ComfyUI: export REPLICATE_API_TOKEN="r8_..." (from replicate.com/account/api-tokens).
Common issues & troubleshooting
The audio output won't preview or save. The pack's README is upfront that it was built for "simple text or image outputs," and lists better audio and video support as a roadmap item. MusicGen returns real audio here, but it's the least-mature part of the pack. If the AUDIO port misbehaves, update ComfyUI so it has native AUDIO support, and confirm you've got a save-audio node downstream.
The melody conditioning does nothing. input_audio only steers the tune on a melody model version. Pick stereo-melody-large or melody-large - the plain large/stereo-large ignore it.
Longer clips drift or repeat. MusicGen gets less coherent the longer it runs. Keep duration modest and use continuation to extend a good clip rather than asking for one long take, and nudge temperature down if it wanders harmonically.
You wanted a song with singing. MusicGen is instrumental only - that's a model limitation, not a setting. For vocals you'd layer a separate voice model on top.
Inputs (16)
| Name | Type | Default | Description |
|---|---|---|---|
| model_versionopt | COMBO | stereo-melody-large | 4 options: stereo-melody-large, stereo-large, melody-large, large |
| promptopt | STRING | — | |
| input_audioopt | AUDIO | — | |
| durationopt | INT | 8 | — |
| continuationopt | BOOLEAN | false | — |
| continuation_startopt | INT | 0 | — |
| continuation_endopt | INT | — | |
| multi_band_diffusionopt | BOOLEAN | false | — |
| normalization_strategyopt | COMBO | loudness | 4 options: loudness, clip, peak, rms |
| top_kopt | INT | 250 | — |
| top_popt | FLOAT | 0.00 | — |
| temperatureopt | FLOAT | 1.00 | — |
| classifier_free_guidanceopt | INT | 3 | — |
| output_formatopt | COMBO | wav | 2 options: wav, mp3 |
| seedopt | INT | — | |
| force_rerunopt | BOOLEAN | false | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| AUDIO | AUDIO | — |