使用火山引擎Imagination API生成音乐,支持人声歌曲、纯音乐BGM及歌词创作,适用于用户想创作歌曲、背景音乐等场景。
This skill generates music using the Volcengine Music Generation API. It supports vocal songs, instrumental BGM, and AI lyrics generation.
Before using this skill, ensure the following environment variables are set:
VOLCENGINE_ACCESS_KEY — AccessKey IDVOLCENGINE_SECRET_KEY — AccessKey SecretHow to obtain: Volcengine Console → Account (top-right) → Key Management → Create Key.
song / bgm / lyrics).cd to the skill directory: skills/byted-music-generate.audio_url or lyrics from the JSON output to the user.User provides lyrics (Lyrics) or a text prompt (Prompt) to generate a vocal song.
bash
# With text prompt
python scripts/music_generate.py song --prompt "A song about summer at the beach" --genre Pop --gender Female
# With lyrics
python scripts/music_generate.py song --lyrics "[verse]\nMoonlight on the windowsill\nMemories flowing like water\n[chorus]\nYou are my moonlight" --genre Folk --mood "Sentimental/Melancholic/Lonely"
Note: --lyrics and --prompt are mutually exclusive; lyrics takes priority. If the user hasn't provided lyrics, you can first use the lyrics mode to generate them, then pass the result to the song mode.
Describe the desired music in natural language. The v5.0 model does not require Genre/Mood parameters — just describe everything in the --text field.
bash
python scripts/music_generate.py bgm --text "Relaxed coffee shop ambiance music with piano and guitar" --duration 60
# With song structure segments
python scripts/music_generate.py bgm --text "Epic game soundtrack" --segments '[{"Name":"intro","Duration":10},{"Name":"chorus","Duration":30}]'
Returns synchronously (no polling needed). Can be used standalone or as a pre-step for the song mode.
bash
python scripts/music_generate.py lyrics --prompt "A song about graduation farewell" --genre Folk --mood "Sentimental/Melancholic/Lonely" --gender Female
bash
python scripts/music_generate.py query --task-id "202601397834584670076931"
text
User Request
↓
Contains "instrumental/BGM/background music/soundtrack"?
├─ Yes → bgm mode
└─ No → Contains "lyrics/write lyrics" and does NOT request audio?
├─ Yes → lyrics mode
└─ No → song mode
├─ User provided lyrics → --lyrics
└─ User only described a theme → --prompt (or lyrics first, then song)
ParameterRequiredDescription--lyricseitherLyrics with structure tags--prompteitherText prompt (Chinese, 5-700 chars)--model-versionnov4.0 or v4.3 (default: v4.3)--genrenoMusic genre--moodnoMusic mood--gendernoFemale / Male``--timbrenoVocal timbre--durationnoDuration in seconds [30-240]--keynoMusical key (v4.3 only)--kmodenoMajor / Minor (v4.3 only)--temponoTempo (v4.3 only)--instrumentnoInstruments, comma-separated (v4.3 only)--genre-extranoSecondary genres, comma-separated, max 2 (v4.3 only)--scenenoScene tags, comma-separated (v4.3 only)--langnoLanguage (v4.3 only)--vod-formatnowav / mp3 (v4.3 only)--billingnoprepaid / postpaid (default: postpaid)--timeoutnoMax wait seconds (default: 300)
ParameterRequiredDescription--textyesNatural language description--durationnoDuration in seconds [30-120]--segmentsnoJSON array of song structure segments--versionnoModel version (default: v5.0)--enable-input-rewritenoEnable prompt rewriting--billingnoprepaid / postpaid (default: postpaid)--timeoutnoMax wait seconds (default: 300)
ParameterRequiredDescription--promptyesLyrics prompt (Chinese only, <500 chars)--genrenoMusic genre--moodnoMusic mood--gendernoFemale / Male
The script outputs JSON with the following fields:
json
{
"status": "success | timeout | error",
"mode": "song | bgm | lyrics | query",
"task_id": "...",
"audio_url": "https://...",
"duration": 46.0,
"lyrics": "...",
"error": null
}
Return the audio_url to the user for download or playback. URLs are valid for approximately 1 year, but users should save the file promptly.
PermissionError: VOLCENGINE_ACCESS_KEY ...: Inform the user to configure the environment variables. Write them to the workspace environment variable file, then retry.status: "timeout": The task is still generating. Provide the user with the task_id and the manual query command from the output.