Media musicgen

From damionrashford/media-os · View interactive version

Media musicgen is an AI agent skill from the GitHub repository damionrashford/media-os. Open-source AI music generation with permissive-license models: Riffusion (MIT, spectrogram-to-audio music from text), YuE (Apache 2.0, Chinese Academy 2025 full-song generation with vocals), Stable Audio Open (Stability community license, commercial up to 1M ARR). Text-to-music, genre-conditioned g

How to use this skill

Skill file

Media MusicGen

Context: $ARGUMENTS

Quick start

When to use

Do NOT use this skill for:

Step 1 — Pick a model

| Task | Recommended | License | Commercial use? | Vocals? |

| ------------------------------------------ | ----------------- | ----------------------------------------------- | ---------------------------- | ------- |

| Any, lowest friction, fully permissive | Riffusion | MIT | Yes, unconditionally | No |

| Full song with vocals, best 2025 quality | YuE | Apache 2.0 | Yes, unconditionally | Yes |

| Highest audio quality, instrumental | Stable Audio Open | Stability AI Community License | Yes, up to $1M annual revenue | No |

Full license audit (including excluded models and Stable Audio's $1M ARR cap) in CODE0.

Step 2 — Install

# Riffusion (MIT, diffusers-based)
pip install diffusers transformers torch accelerate soundfile

# YuE (Apache 2.0) — HuggingFace transformers based
pip install transformers torch soundfile
# YuE models: m-a-p/YuE-s1-7B-anneal-en-cot (English, chain-of-thought)
#             m-a-p/YuE-s1-7B-anneal-zh-cot (Mandarin)

# Stable Audio Open (Stability Community License)
pip install stable-audio-tools soundfile
# (HuggingFace: stabilityai/stable-audio-open-1.0)

Or let the script help:

uv run ${CLAUDE_SKILL_DIR}/scripts/musicgen.py install riffusion
uv run ${CLAUDE_SKILL_DIR}/scripts/musicgen.py install yue
uv run ${CLAUDE_SKILL_DIR}/scripts/musicgen.py install stable-audio-open

Check what's available:

uv run ${CLAUDE_SKILL_DIR}/scripts/musicgen.py check

Step 3 — Generate

# Riffusion — fast, MIT, spectrogram diffusion
uv run ${CLAUDE_SKILL_DIR}/scripts/musicgen.py generate \
    --model riffusion \
    --prompt "dreamy lo-fi hip-hop beat with mellow piano" \
    --duration 10 \
    --out beat.wav

# YuE — full song with vocals
uv run ${CLAUDE_SKILL_DIR}/scripts/musicgen.py generate \
    --model yue \
    --prompt "emotional indie rock, male vocalist, 80 bpm, acoustic guitar, simple drums" \
    --duration 90 \
    --out song.wav

# Stable Audio Open — 44.1 kHz stereo, instrumental
uv run ${CLAUDE_SKILL_DIR}/scripts/musicgen.py generate \
    --model stable-audio-open \
    --prompt "ambient cinematic strings, slow rise, film score" \
    --duration 47 \
    --out cue.wav

Per-model limits:

Step 4 — Continue an existing audio idea

Feed an existing clip as seed; the model continues in style.

uv run ${CLAUDE_SKILL_DIR}/scripts/musicgen.py continue \
    --in sketch.wav \
    --model stable-audio-open \
    --prompt "add energy, build into chorus" \
    --duration 20 \
    --out extended.wav

Only Stable Audio Open and Riffusion support continuation reliably; YuE's continuation API is less stable.

Step 5 — Split output into stems (vocals / drums / bass / other)

Delegates to the media-demucs skill.

uv run ${CLAUDE_SKILL_DIR}/scripts/musicgen.py stems \
    --in song.wav \
    --out-dir stems/
# -> stems/vocals.wav, stems/drums.wav, stems/bass.wav, stems/other.wav

Step 6 — Post-process / mux

Gotchas

Examples

Example 1: 10-second background music for a video intro

uv run ${CLAUDE_SKILL_DIR}/scripts/musicgen.py generate \
    --model riffusion \
    --prompt "upbeat corporate bright synth pad, inspirational" \
    --duration 10 \
    --out intro_music.wav

ffmpeg -i intro.mp4 -i intro_music.wav \
    -map 0:v -map 1:a -c:v copy -shortest intro_scored.mp4

Example 2: Full 90-second indie rock song with vocals via YuE

uv run ${CLAUDE_SKILL_DIR}/scripts/musicgen.py generate \
    --model yue \
    --prompt "[Verse 1] acoustic guitar picking, soft male vocals about a road trip. [Chorus] full band, big drums, uplifting harmonies, 80 bpm. [Verse 2] same as verse 1 with harmony vocal." \
    --duration 90 \
    --seed 42 \
    --out indie_song.wav

Example 3: Stable Audio Open cinematic cue + stem split for DAW mix

# Generate
uv run ${CLAUDE_SKILL_DIR}/scripts/musicgen.py generate \
    --model stable-audio-open \
    --prompt "ambient cinematic strings, slow build, film score, Johann Johannsson style" \
    --duration 45 \
    --out cue.wav

# Split stems for further work
uv run ${CLAUDE_SKILL_DIR}/scripts/musicgen.py stems --in cue.wav --out-dir cue_stems/
# -> cue_stems/{vocals,drums,bass,other}.wav (other will dominate for instrumental)

Example 4: Extend a sketch idea

uv run ${CLAUDE_SKILL_DIR}/scripts/musicgen.py continue \
    --in sketch_8bars.wav \
    --model stable-audio-open \
    --prompt "build into a climax, more energy, bigger drums" \
    --duration 15 \
    --out sketch_extended.wav

Troubleshooting

Error: `ModuleNotFoundError: No module named 'diffusers'`

Cause: Riffusion backend isn't installed.

Solution: pip install diffusers transformers torch accelerate soundfile or scripts/musicgen.py install riffusion.

Error: `CUDA out of memory` on YuE

Cause: YuE 7B needs ~16 GB VRAM in fp16.

Solution: load in int4 / bnb-4bit (--load-in-4bit flag; requires bitsandbytes), shorten duration, or generate on CPU (slow — 30+ min).

Output clips at 5 s for longer prompts

Cause: Riffusion's native window is 5 s; longer requires the crossfade-loop which the script normally handles automatically.

Solution: confirm --duration exceeds 5 and that the script version is up to date. Try --model stable-audio-open for native long-form.

YuE produces melody but no vocals

Cause: prompt lacks section markers or vocal cues.

Solution: use [Verse 1] / [Chorus] tags and mention vocals explicitly ("male vocalist", "female vocalist", "harmonies").

Generated music sounds like a specific copyrighted song

Cause: overly specific artist / song reference in the prompt.

Solution: describe the style instead of the source (e.g. "melancholic 90s grunge with distorted guitars" rather than "a Nirvana song").

Stable Audio Open refuses to run locally

Cause: Stability CC access-gated on HuggingFace.

Solution: accept the model license on https://huggingface.co/stabilityai/stable-audio-open-1.0 and huggingface-cli login.

Reference docs

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.