music-generation
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseMusic Generation Skill
音乐生成技能
Generate music, songs, and audio using AI (Suno, Udio, Google Lyria).
借助AI(Suno、Udio、Google Lyria)生成音乐、歌曲和音频。
Prerequisites
前置条件
At least one API key is required:
- - For Google Lyria (same key as video/image) ✅
GOOGLE_API_KEY - - For Suno music generation
SUNO_API_KEY - - For Udio music generation
UDIO_API_KEY
至少需要一个API密钥:
- - 用于Google Lyria(与视频/图像生成使用相同密钥) ✅
GOOGLE_API_KEY - - 用于Suno音乐生成
SUNO_API_KEY - - 用于Udio音乐生成
UDIO_API_KEY
Available APIs
可用API
Google Lyria (Instrumental Only)
Google Lyria(仅支持器乐)
- Best for: Background music, beats, soundtracks, game audio
- Duration: Any length (streams in real-time)
- Features: BPM control, key/scale, brightness, density
- Output: 48kHz stereo WAV
- API Key: Same as video/image generation ✅
GOOGLE_API_KEY - ⚠️ INSTRUMENTAL ONLY - Cannot generate vocals
- 最适合用于:背景音乐、节拍、原声配乐、游戏音频
- 时长:任意长度(实时流式生成)
- 特性:BPM控制、调式/音阶、明亮度、密度调节
- 输出格式:48kHz 立体声WAV
- API密钥:与视频/图像生成使用相同的✅
GOOGLE_API_KEY - ⚠️ 仅支持器乐 - 无法生成人声
Suno (Recommended for Songs with Vocals)
Suno(推荐用于带人声的歌曲)
- Best for: Full songs with vocals, catchy melodies, various genres
- Duration: Up to 4 minutes
- Features: Lyrics generation, instrumental mode, style tags
- Genres: Pop, rock, jazz, electronic, classical, hip-hop, and more
- 最适合用于:带人声的完整歌曲、朗朗上口的旋律、多种流派
- 时长:最长4分钟
- 特性:歌词生成、器乐模式、风格标签
- 流派:流行、摇滚、爵士、电子、古典、嘻哈等
Udio
Udio
- Best for: High-fidelity audio, experimental styles, remixes
- Duration: Up to 2 minutes per generation
- Features: Style control, audio quality options
- Genres: Wide variety with strong electronic/experimental support
- 最适合用于:高保真音频、实验风格、混音作品
- 时长:每次生成最长2分钟
- 特性:风格控制、音频质量选项
- 流派:种类丰富,尤其擅长电子/实验风格
Workflow
工作流程
Step 1: Ask Key Question - Vocals or Instrumental?
步骤1:确认核心问题 - 是否需要人声?
This determines which API to use:
| Need | API | Why |
|---|---|---|
| Vocals/Lyrics | Suno or Udio | Lyria cannot generate vocals |
| Instrumental only | Lyria (preferred) | Same API key as video/image, real-time control |
| Background music | Lyria | Best for soundtracks, game audio |
| Full songs | Suno | Best vocal quality |
Example prompt to user:
"I'll generate that music! Quick question:
-
Do you need vocals/lyrics?
- Yes → I'll use Suno (best for songs)
- No, instrumental only → I'll use Lyria (same key as video/image)
-
What genre/mood? (e.g., chill lo-fi, epic orchestral, upbeat pop)
-
How long? (Lyria: any length, Suno: up to 4 min)
-
Any BPM preference? (e.g., 90 for chill, 128 for dance)"
这将决定使用哪个API:
| 需求 | API | 原因 |
|---|---|---|
| 需要人声/歌词 | Suno或Udio | Lyria无法生成人声 |
| 仅需要器乐 | Lyria(优先推荐) | 与视频/图像生成使用相同API密钥,支持实时控制 |
| 背景音乐 | Lyria | 最适合原声配乐、游戏音频 |
| 完整歌曲 | Suno | 人声质量最佳 |
示例用户提问引导:
"我这就为你生成音乐!快速确认几个问题:
-
你是否需要人声/歌词?
- 是 → 我将使用Suno(最适合生成歌曲)
- 否,仅需要器乐 → 我将使用Lyria(与视频/图像生成使用相同密钥)
-
你想要什么流派/氛围?(例如:舒缓lo-fi、史诗管弦乐、欢快流行)
-
时长要求?(Lyria:任意时长,Suno:最长4分钟)
-
是否有BPM偏好?(例如:舒缓风格选90,舞曲选128)"
Step 2: Understand the Request
步骤2:理解用户需求
Parse the user's music request for:
- Genre/style: Pop, rock, jazz, electronic, classical, etc.
- Mood: Happy, sad, energetic, calm, dramatic
- Tempo: Fast, slow, medium, specific BPM
- Vocals: With vocals → Suno/Udio, Instrumental → Lyria
- Purpose: Background music, song, jingle, soundtrack
- Duration: How long should it be?
解析用户的音乐生成请求,明确以下信息:
- 流派/风格:流行、摇滚、爵士、电子、古典等
- 氛围:开心、悲伤、充满活力、平静、戏剧化
- 节奏:快、慢、中等、特定BPM
- 人声需求:带人声 → Suno/Udio,仅器乐 → Lyria
- 用途:背景音乐、歌曲、广告短曲、原声配乐
- 时长:需要多长的音乐?
Step 2: Craft the Prompt
步骤2:撰写提示词
Transform the user request into an effective music generation prompt:
- Specify genre: Be specific about the style
- Describe mood: Emotional tone and energy level
- Include instruments: What should be prominent
- Add production style: Lo-fi, polished, vintage, modern
- Set tempo: BPM or descriptive (upbeat, slow)
Example transformation:
- User: "happy summer song"
- Enhanced: "Upbeat indie pop song with bright acoustic guitar, cheerful ukulele, and sunny vibes. Feel-good summer anthem with catchy hooks and positive energy. Male vocals, 120 BPM, radio-friendly production"
将用户的请求转化为有效的音乐生成提示词:
- 明确流派:具体说明音乐风格
- 描述氛围:情绪基调与能量水平
- 指定乐器:突出使用的乐器
- 添加制作风格:lo-fi、精致打磨、复古、现代
- 设置节奏:指定BPM或用描述性词汇(欢快、舒缓)
示例转化:
- 用户:“开心的夏日歌曲”
- 优化后:“欢快的独立流行歌曲,搭配明亮的原声吉他、愉悦的尤克里里和阳光氛围。令人愉悦的夏日主题曲,朗朗上口的钩子和积极的能量。男性人声,120 BPM,符合电台播放标准的制作风格”
Step 3: Handle Lyrics (If Needed)
步骤3:处理歌词(如有需要)
For songs with vocals:
- User provides lyrics: Use them directly
- Generate lyrics: Ask Suno/Udio to generate, or use Claude to write them first
- Instrumental: Specify "instrumental" to skip vocals
Lyrics format for Suno:
[Verse 1]
Your lyrics here
[Chorus]
Catchy chorus lyrics
[Verse 2]
More lyrics对于带人声的歌曲:
- 用户提供歌词:直接使用
- 生成歌词:请求Suno/Udio生成,或先使用Claude撰写
- 仅器乐:明确指定“仅器乐”以跳过人声
Suno的歌词格式:
[Verse 1]
Your lyrics here
[Chorus]
Catchy chorus lyrics
[Verse 2]
More lyricsStep 4: Select the API
步骤4:选择API
Choose based on requirements:
| Use Case | Recommended API | Reason |
|---|---|---|
| Instrumental/background | Lyria | Same API key, any duration, real-time control |
| Full songs with vocals | Suno | Best vocal quality |
| Lo-fi beats | Lyria | Great for ambient/chill |
| Experimental/electronic | Udio | Strong in these genres |
| Specific lyrics needed | Suno | Lyrics input support |
| Game/video soundtrack | Lyria | Precise BPM/key control |
根据需求选择合适的API:
| 使用场景 | 推荐API | 原因 |
|---|---|---|
| 器乐/背景音乐 | Lyria | 共享API密钥,支持任意时长,实时控制 |
| 带人声的完整歌曲 | Suno | 人声质量最佳 |
| Lo-fi节拍 | Lyria | 非常适合氛围/舒缓风格 |
| 实验/电子风格 | Udio | 在这些流派表现出色 |
| 需要特定歌词 | Suno | 支持歌词输入 |
| 游戏/视频原声配乐 | Lyria | 精确的BPM/调式控制 |
Step 5: Generate the Music
步骤5:生成音乐
Execute the appropriate script from :
${CLAUDE_PLUGIN_ROOT}/skills/music-generation/scripts/For Google Lyria (Instrumental):
bash
python3 ${CLAUDE_PLUGIN_ROOT}/skills/music-generation/scripts/lyria.py \
--prompt "chill lo-fi hip hop, jazzy piano, vinyl crackle" \
--duration 60 \
--bpm 85Lyria with key/scale:
bash
python3 ${CLAUDE_PLUGIN_ROOT}/skills/music-generation/scripts/lyria.py \
--prompt "ambient, ethereal synths, dreamy" \
--duration 120 \
--scale "C" \
--brightness 0.7Lyria with multiple prompts (blended):
bash
python3 ${CLAUDE_PLUGIN_ROOT}/skills/music-generation/scripts/lyria.py \
--prompt "minimal techno" \
--prompt "deep bass, 808" \
--bpm 128 \
--duration 90For Suno (with vocals):
bash
python3 ${CLAUDE_PLUGIN_ROOT}/skills/music-generation/scripts/suno.py \
--prompt "upbeat indie pop, summer vibes, acoustic guitar" \
--title "Summer Days"For Udio:
bash
python3 ${CLAUDE_PLUGIN_ROOT}/skills/music-generation/scripts/udio.py \
--prompt "cinematic orchestral, epic trailer music" \
--duration 120执行路径下的对应脚本:
${CLAUDE_PLUGIN_ROOT}/skills/music-generation/scripts/使用Google Lyria(仅器乐):
bash
python3 ${CLAUDE_PLUGIN_ROOT}/skills/music-generation/scripts/lyria.py \
--prompt "chill lo-fi hip hop, jazzy piano, vinyl crackle" \
--duration 60 \
--bpm 85带调式/音阶的Lyria使用:
bash
python3 ${CLAUDE_PLUGIN_ROOT}/skills/music-generation/scripts/lyria.py \
--prompt "ambient, ethereal synths, dreamy" \
--duration 120 \
--scale "C" \
--brightness 0.7多提示词混合的Lyria使用:
bash
python3 ${CLAUDE_PLUGIN_ROOT}/skills/music-generation/scripts/lyria.py \
--prompt "minimal techno" \
--prompt "deep bass, 808" \
--bpm 128 \
--duration 90使用Suno(带人声):
bash
python3 ${CLAUDE_PLUGIN_ROOT}/skills/music-generation/scripts/suno.py \
--prompt "upbeat indie pop, summer vibes, acoustic guitar" \
--title "Summer Days"使用Udio:
bash
python3 ${CLAUDE_PLUGIN_ROOT}/skills/music-generation/scripts/udio.py \
--prompt "cinematic orchestral, epic trailer music" \
--duration 120Step 6: Deliver the Result
步骤6:交付结果
- Provide the generated audio file path
- Share the prompt and settings used
- Mention the duration and format
- Offer to:
- Generate variations
- Try different style/genre
- Adjust tempo or mood
- Extend the track
- Add or remove vocals
- 提供生成的音频文件路径
- 分享使用的提示词和设置
- 说明时长和格式
- 提供后续服务选项:
- 生成变体版本
- 尝试不同风格/流派
- 调整节奏或氛围
- 延长曲目
- 添加或移除人声
Error Handling
错误处理
Missing API key: Inform the user which key is needed:
- Lyria: Same as video/image - https://aistudio.google.com/apikey
GOOGLE_API_KEY - Suno: https://suno.com/api (or app.suno.ai)
- Udio: https://udio.com/api
Lyria requires google-genai package:
pip install google-genaiUser wants vocals but only has GOOGLE_API_KEY: Explain Lyria is instrumental-only, suggest Suno/Udio.
Content policy violation: Rephrase lyrics or prompt.
Generation failed: Retry with simplified prompt.
Quota exceeded: Suggest waiting or trying other provider.
缺少API密钥:告知用户需要的密钥类型:
- Lyria:与视频/图像生成使用相同的- https://aistudio.google.com/apikey
GOOGLE_API_KEY - Suno:https://suno.com/api(或app.suno.ai)
- Udio:https://udio.com/api
Lyria需要google-genai包:执行安装
pip install google-genai用户想要人声但仅拥有GOOGLE_API_KEY:说明Lyria仅支持器乐,建议使用Suno/Udio。
违反内容政策:重新措辞歌词或提示词。
生成失败:使用简化的提示词重试。
配额耗尽:建议等待或尝试其他服务商。
Prompt Engineering Tips
提示词工程技巧
Genre Tags (Suno Style)
流派标签(Suno风格)
Include specific genre tags for best results:
[pop, upbeat, female vocals, 128 BPM][jazz, smooth, saxophone, laid-back][electronic, synthwave, 80s, driving][classical, orchestral, emotional, strings]
添加具体的流派标签以获得最佳效果:
[pop, upbeat, female vocals, 128 BPM][jazz, smooth, saxophone, laid-back][electronic, synthwave, 80s, driving][classical, orchestral, emotional, strings]
Mood Descriptors
氛围描述词
- Energetic: upbeat, driving, powerful, intense
- Calm: relaxing, ambient, peaceful, gentle
- Happy: cheerful, bright, sunny, joyful
- Sad: melancholic, emotional, heartfelt, somber
- Epic: cinematic, dramatic, sweeping, grand
- 充满活力:欢快、强劲、有力、激烈
- 平静:放松、氛围音乐、平和、轻柔
- 开心:愉悦、明亮、阳光、快乐
- 悲伤:忧郁、深情、诚挚、阴沉
- 史诗:电影感、戏剧化、宏大、壮阔
Production Style
制作风格
- Lo-fi: warm, vintage, tape hiss, nostalgic
- Polished: crisp, modern, radio-ready, professional
- Raw: garage, live, organic, unpolished
- Electronic: synthesizers, digital, processed
- Lo-fi:温暖、复古、磁带杂音、怀旧
- 精致打磨:清晰、现代、符合电台标准、专业
- 原始:车库风、现场感、自然、未经打磨
- 电子:合成器、数字化、经过处理
API Comparison
API对比
| Feature | Lyria | Suno | Udio |
|---|---|---|---|
| API Key | | | |
| Max duration | Unlimited | 4 minutes | 2 minutes |
| Vocals | ❌ No | ✅ Excellent | ✅ Good |
| Instrumentals | ✅ Excellent | ✅ Great | ✅ Excellent |
| BPM control | ✅ 60-200 | ❌ No | ❌ No |
| Key/Scale control | ✅ Yes | ❌ No | ❌ No |
| Audio quality | 48kHz WAV | Very good | Excellent |
| Lyrics input | ❌ No | ✅ Yes | ✅ Yes |
| Real-time steering | ✅ Yes | ❌ No | ❌ No |
| Best for | Beats, soundtracks | Songs | Experimental |
| 特性 | Lyria | Suno | Udio |
|---|---|---|---|
| API密钥 | | | |
| 最长时长 | 无限制 | 4分钟 | 2分钟 |
| 人声支持 | ❌ 不支持 | ✅ 优秀 | ✅ 良好 |
| 器乐支持 | ✅ 优秀 | ✅ 出色 | ✅ 优秀 |
| BPM控制 | ✅ 60-200 | ❌ 不支持 | ❌ 不支持 |
| 调式/音阶控制 | ✅ 支持 | ❌ 不支持 | ❌ 不支持 |
| 音频质量 | 48kHz WAV | 非常好 | 优秀 |
| 歌词输入 | ❌ 不支持 | ✅ 支持 | ✅ 支持 |
| 实时调控 | ✅ 支持 | ❌ 不支持 | ❌ 不支持 |
| 最佳用途 | 节拍、原声配乐 | 歌曲 | 实验风格 |
Example Prompts
示例提示词
Pop Song
流行歌曲
Catchy pop song with female vocals, bright synths, and an anthemic chorus.
Feel-good energy, summer vibes, 120 BPM, radio-friendly production.朗朗上口的流行歌曲,搭配女性人声、明亮的合成器和主旋律合唱。充满愉悦感的活力,夏日氛围,120 BPM,符合电台播放标准的制作风格。Cinematic Score
电影原声
Epic orchestral trailer music with building tension. Powerful brass,
sweeping strings, thundering percussion. Dramatic and emotional.史诗般的管弦乐预告片音乐,逐渐增强的紧张感。强劲的铜管乐器、宏大的弦乐、雷鸣般的打击乐。充满戏剧化和情感张力。Lo-fi Beat
Lo-fi节拍
Chill lo-fi hip hop beat, jazzy piano samples, vinyl crackle,
relaxed drums, perfect for studying. 85 BPM, nostalgic mood.舒缓的lo-fi嘻哈节拍,爵士钢琴采样,黑胶唱片杂音,放松的鼓点,非常适合学习时聆听。85 BPM,怀旧氛围。Electronic Dance
电子舞曲
High-energy EDM track with massive drops, pulsing synths,
four-on-the-floor beat. Festival-ready, 128 BPM.高能量EDM曲目,搭配震撼的降调、脉冲合成器、四四拍鼓点。适合音乐节播放,128 BPM。Lyria-Specific Examples
Lyria专属示例
Lo-fi Study Beats
Lo-fi学习节拍
bash
python3 lyria.py -p "lo-fi hip hop, jazzy piano, vinyl crackle, chill" \
--duration 300 --bpm 85 --brightness 0.3bash
python3 lyria.py -p "lo-fi hip hop, jazzy piano, vinyl crackle, chill" \
--duration 300 --bpm 85 --brightness 0.3Techno/Dance
科技舞曲
bash
python3 lyria.py -p "minimal techno, deep bass, 808 drums" \
--duration 120 --bpm 128 --density 0.7bash
python3 lyria.py -p "minimal techno, deep bass, 808 drums" \
--duration 120 --bpm 128 --density 0.7Ambient/Meditation
氛围/冥想音乐
bash
python3 lyria.py -p "ambient, ethereal, soft pads, dreamy" \
--duration 180 --brightness 0.8 --density 0.2bash
python3 lyria.py -p "ambient, ethereal, soft pads, dreamy" \
--duration 180 --brightness 0.8 --density 0.2Game Soundtrack
游戏原声配乐
bash
python3 lyria.py -p "epic orchestral, cinematic, dramatic strings" \
--duration 90 --scale "D" --mode qualitybash
python3 lyria.py -p "epic orchestral, cinematic, dramatic strings" \
--duration 90 --scale "D" --mode qualityLyria Prompt Tips
Lyria提示词技巧
- Instruments: piano, guitar, synth, drums, bass, strings, 808, Rhodes, Moog
- Genres: lo-fi hip hop, minimal techno, ambient, jazz fusion, synthwave, chillout
- Moods: chill, energetic, dreamy, dark, upbeat, melancholic, epic
- Combine prompts: Use multiple flags to blend styles
-p
- 乐器:piano, guitar, synth, drums, bass, strings, 808, Rhodes, Moog
- 流派:lo-fi hip hop, minimal techno, ambient, jazz fusion, synthwave, chillout
- 氛围:chill, energetic, dreamy, dark, upbeat, melancholic, epic
- 混合提示词:使用多个参数来混合多种风格
-p