music-generation
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseMusic Generation Skill
音乐生成Skill
Overview
概述
This skill generates songs (vocal or instrumental) from a structured JSON spec using the
MiniMax music generation API (). You describe the style/mood/scene in
, optionally provide , and the script returns an MP3.
/v1/music_generationpromptlyrics此Skill通过MiniMax音乐生成API(),根据结构化的JSON规范生成歌曲(带人声或纯器乐)。你可以在中描述风格/情绪/场景,可选提供,脚本会返回一个MP3文件。
/v1/music_generationpromptlyricsWorkflow
工作流程
Step 1: Understand Requirements
步骤1:理解需求
Identify the desired style, mood, scene, language, and whether the user wants vocals or a
pure instrumental track. Decide whether to supply lyrics or let the model write them.
确定用户期望的风格、情绪、场景、语言,以及用户想要带人声的歌曲还是纯器乐曲目。决定是否提供歌词,还是让模型自动生成歌词。
Step 2: Create the Spec JSON
步骤2:创建规范JSON
Write a JSON file in named :
/mnt/user-data/workspace/{descriptive-name}.jsonjson
{
"title": "Rainy Night Cafe",
"prompt": "indie folk, melancholic, introspective, walking alone, cafe",
"lyrics": "[verse]\nStreetlights glow the night wind sighs\n[chorus]\nPush the wooden door warm air inside"
}Fields:
- (optional): a human-readable name.
title - (required): style, mood, and scene. Drives the musical character.
prompt - (optional): song lyrics. Use
lyricsbetween lines and structure tags such as\n,[Intro],[Verse],[Pre Chorus],[Chorus],[Bridge].[Outro] - (optional, bool): set
is_instrumentalfor a pure instrumental track (no lyrics needed).true
Behavior:
- provided → those lyrics are sung.
lyrics - → instrumental, no vocals.
is_instrumental: true - neither → the model auto-writes lyrics from (
prompt).lyrics_optimizer
在目录下创建一个名为的JSON文件:
/mnt/user-data/workspace/{描述性名称}.jsonjson
{
"title": "Rainy Night Cafe",
"prompt": "indie folk, melancholic, introspective, walking alone, cafe",
"lyrics": "[verse]\nStreetlights glow the night wind sighs\n[chorus]\nPush the wooden door warm air inside"
}字段说明:
- (可选):便于识别的歌曲名称。
title - (必填):风格、情绪和场景描述,决定音乐的整体特征。
prompt - (可选):歌曲歌词。行与行之间用
lyrics分隔,可使用\n、[Intro]、[Verse]、[Pre Chorus]、[Chorus]、[Bridge]等结构标签。[Outro] - (可选,布尔值):设为
is_instrumental时生成纯器乐曲目(无需歌词)。true
行为逻辑:
- 提供→ 将演唱该歌词。
lyrics - 设置→ 生成纯器乐,无人声。
is_instrumental: true - 两者都不设置 → 模型根据自动生成歌词(启用
prompt)。lyrics_optimizer
Step 3: Execute Generation
步骤3:执行生成
bash
python /mnt/skills/public/music-generation/scripts/generate.py \
--prompt-file /mnt/user-data/workspace/rainy-night-cafe.json \
--output-file /mnt/user-data/outputs/rainy-night-cafe.mp3Parameters:
- : Absolute path to the JSON spec (required).
--prompt-file - : Absolute path for the output MP3 (required).
--output-file
[!NOTE]
Do NOT read the python file, just call it with the parameters.
bash
python /mnt/skills/public/music-generation/scripts/generate.py \
--prompt-file /mnt/user-data/workspace/rainy-night-cafe.json \
--output-file /mnt/user-data/outputs/rainy-night-cafe.mp3参数说明:
- :JSON规范文件的绝对路径(必填)。
--prompt-file - :输出MP3文件的绝对路径(必填)。
--output-file
[!注意]
请勿读取该Python文件,只需按参数调用它即可。
Environment
环境配置
- (required): your MiniMax interface key.
MINIMAX_API_KEY - (optional): default
MINIMAX_API_HOST.https://api.minimaxi.com - (optional): default
MINIMAX_MUSIC_MODEL(works for all API-key users); paid/Token-Plan users can setmusic-2.6-freefor higher limits.music-2.6
- (必填):你的MiniMax接口密钥。
MINIMAX_API_KEY - (可选):默认值为
MINIMAX_API_HOST。https://api.minimaxi.com - (可选):默认值为
MINIMAX_MUSIC_MODEL(适用于所有API密钥用户);付费/Token套餐用户可设置为music-2.6-free以获得更高调用限额。music-2.6
Output Handling
输出处理
- Music is saved as MP3 (typically in ).
/mnt/user-data/outputs/ - Share the generated file with the user using the present_files tool.
- Offer to iterate on style or lyrics if adjustments are needed.
- 音乐将保存为MP3格式(通常存储在目录下)。
/mnt/user-data/outputs/ - 使用present_files工具将生成的文件分享给用户。
- 如果需要调整,可主动提出对风格或歌词进行迭代优化。
Notes
注意事项
- Keep focused on style/mood/scene; put the actual sung words in
prompt.lyrics - For non-English songs, write in the target language.
lyrics
- 应聚焦于风格/情绪/场景描述;实际演唱的歌词请放在
prompt中。lyrics - 若要生成非英语歌曲,请用目标语言编写。
lyrics