music
它能做什么
这项技能使用 ElevenLabs Music,根据文字提示创作音乐。适合需要纯音乐、广告短曲或带歌词歌曲的创作者。
适用场景
- ✓当你的项目需要一段纯音乐背景音轨时。
- ✓当你想为品牌制作一段广告短曲,或一首带歌词的歌曲时。
- ✓当你想用作曲方案更精细地控制歌曲结构时。
技能链接
https://github.com/calesthio/OpenMontage/blob/main/.agents/skills/music/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请帮我创作一段 30 秒的 lo-fi 嘻哈背景音乐,配上爵士风格的钢琴和弦。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会把风格描述和时长发送给 ElevenLabs Music,然后保存音频文件。如果想更精细地控制,它可以先生成一份作曲方案,列出歌曲的各个段落。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
ElevenLabs Music Generation
Generate music from text prompts - supports instrumental tracks, songs with lyrics, and fine-grained control via composition plans.
Setup: See Installation Guide. For JavaScript, use
@elevenlabs/*packages only.
Quick Start
Python
from elevenlabs import ElevenLabs
client = ElevenLabs()
audio = client.music.compose(
prompt="A chill lo-fi hip hop beat with jazzy piano chords",
music_length_ms=30000
)
with open("output.mp3", "wb") as f:
for chunk in audio:
f.write(chunk)
JavaScript
import { ElevenLabsClient } from "@elevenlabs/elevenlabs-js";
import { createWriteStream } from "fs";
const client = new ElevenLabsClient();
const audio = await client.music.compose({
prompt: "A chill lo-fi hip hop beat with jazzy piano chords",
musicLengthMs: 30000,
});
audio.pipe(createWriteStream("output.mp3"));
cURL
curl -X POST "https://api.elevenlabs.io/v1/music" \
-H "xi-api-key: $ELEVENLABS_API_KEY" -H "Content-Type: application/json" \
-d '{"prompt": "A chill lo-fi beat", "music_length_ms": 30000}' --output output.mp3
Methods
| Method | Description |
|---|---|
music.compose |
Generate audio from a prompt or composition plan |
music.composition_plan.create |
Generate a structured plan for fine-grained control |
music.compose_detailed |
Generate audio + composition plan + metadata |
music.upload |
Upload an audio file for later inpainting workflows and optionally extract its composition plan |
See API Reference for full parameter details.
music.upload is available to enterprise clients with access to the inpainting feature.
Composition Plans
For granular control, generate a composition plan first, modify it, then compose:
plan = client.music.composition_plan.create(
prompt="An epic orchestral piece building to a climax",
music_length_ms=60000
)
# Inspect/modify styles and sections
print(plan.positiveGlobalStyles) # e.g. ["orchestral", "epic", "cinematic"]
audio = client.music.compose(
composition_plan=plan,
music_length_ms=60000
)
Content Restrictions
- Cannot reference specific artists, bands, or copyrighted lyrics
bad_prompterrors include aprompt_suggestionwith alternative phrasingbad_composition_planerrors include acomposition_plan_suggestion
Error Handling
try:
audio = client.music.compose(prompt="...", music_length_ms=30000)
except Exception as e:
print(f"API error: {e}")
Common errors: 401 (invalid key), 422 (invalid params), 429 (rate limit).
References
常见问题
一段音乐可以有多长?
你以毫秒为单位设置时长,因此 30 秒的音乐就填 30000。
我能加入歌词吗?
可以。歌曲可以包含歌词,这项技能会说明如何加入。
什么是作曲方案?
它是歌曲的结构化大纲,可以更有效地控制各个段落。
详情
作者的原始描述
Generate music using ElevenLabs Music API. Use when creating instrumental tracks, songs with lyrics, background music, jingles, or any AI-generated music composition. Supports prompt-based generation, composition plans for granular control, and detailed output with metadata.
repo: calesthio/OpenMontage
热度
- GitHub 星标
- 75k
- 排名
- #2679
- 许可证
- AGPL-3.0
- 更新时间
- 2026/10/28
评论
- …