작곡 계획

구조화된 JSON으로 음악 생성을 정밀하게 제어

작곡 계획을 사용하면 음악 생성을 세밀하게 제어할 수 있습니다. music_v2 또는 music_v2_5 계획은 청크의 순서가 있는 목록이며, 각 청크는 고유한 스타일, 가사, 길이로 노래의 한 섹션을 정의합니다. 빠른 프로토타이핑에는 텍스트 프롬프트를 사용하고, 특정 청크 구조, 정밀한 가사 타이밍 또는 복잡한 편곡이 필요한 경우에는 작곡 계획을 사용하세요.

작곡 계획과 텍스트 프롬프트는 함께 사용할 수 없습니다. 둘 중 하나만 사용하세요.

{
"chunks": [
{
"text": "[Verse 1]\nWoke up today with a feeling inside\nSomething is changing I cannot hide\nThe sun on my face and the wind at my back\nI'm finally ready to get on track",
"duration_ms": 16000,
"positive_styles": [
"upbeat pop",
"female vocalist with clear tone",
"acoustic guitar and light synths",
"gentle and conversational vocals",
"light drums in background",
"polished production",
"120 BPM",
"C major"
],
"negative_styles": ["dark", "aggressive", "slow tempo", "a cappella"],
"context_adherence": "high"
},
{
"text": "[Verse 2]\nUsed to be scared of the world outside\nBuilding up walls where I used to hide\nBut now I see clearly what I need to do\nTake that first step into something new",
"duration_ms": 16000,
"positive_styles": [
"confident vocals",
"fuller guitar strumming",
"steady drum beat",
"bass joins in"
],
"negative_styles": ["a cappella", "sparse", "quiet"],
"context_adherence": "high"
},
{
"text": "[Pre-Chorus]\nNo more waiting for tomorrow\nThis is my time now",
"duration_ms": 8000,
"positive_styles": [
"building intensity",
"rising synth melody",
"driving drums",
"full band playing"
],
"negative_styles": ["a cappella", "dropping out"],
"context_adherence": "high"
},
{
"text": "[Chorus]\nI'm breaking through\nNothing's gonna stop me now\nI'm breaking through\nFinally found out how",
"duration_ms": 16000,
"positive_styles": [
"powerful and anthemic vocals",
"full band at maximum energy",
"punchy drums and bass",
"layered synths and guitar"
],
"negative_styles": ["a cappella", "minimal", "stripped back"],
"context_adherence": "high"
},
{
"text": "[Outro]",
"duration_ms": 8000,
"positive_styles": [
"instrumental fade out",
"guitar melody repeating",
"drums softening",
"gentle ending"
],
"negative_styles": ["vocals", "abrupt ending", "building"],
"context_adherence": "high"
}
]
}

청크 기반 작곡 계획에는 music_v2 또는 music_v2_5가 필요합니다. 작곡할 때 model_id="music_v2_5"를 전달하세요.

빠른 시작

음악 빠른 시작을 따라 API 키를 설정하고 SDK를 설치한 다음, 더 세밀한 제어를 위해 작곡 계획을 사용하세요.

1

작곡 계획으로 음악 생성

import os
from dotenv import load_dotenv
from elevenlabs.client import ElevenLabs
load_dotenv()
elevenlabs = ElevenLabs(api_key=os.environ.get("ELEVENLABS_API_KEY"))
composition_plan = {
"chunks": [
{
"text": "[Verse]\nWalking down an empty street\nWondering who I'll meet",
"duration_ms": 15000,
"positive_styles": ["pop", "upbeat", "female vocals", "soft vocals", "acoustic guitar"],
"negative_styles": ["dark", "slow"],
"context_adherence": "high"
},
{
"text": "[Chorus]\nThis is my moment\nI won't let it go",
"duration_ms": 15000,
"positive_styles": ["powerful vocals", "full band"],
"negative_styles": [],
"context_adherence": "high"
}
]
}
audio = elevenlabs.music.compose(
composition_plan=composition_plan,
model_id="music_v2_5",
# with_timestamps=True, # Optional: return word-level timestamps
)
with open("output.mp3", "wb") as f:
for chunk in audio:
f.write(chunk)
2

프롬프트에서 계획 생성

텍스트 설명에서 작곡 계획을 생성한 다음, 생성 전에 수정하세요.

plan = elevenlabs.music.composition_plan.create(
prompt="An upbeat pop song about summer adventures",
music_length_ms=60000,
model_id="music_v2_5"
)
# Modify the generated plan
plan["chunks"][0]["text"] = "[Verse 1]\nCustom lyrics here"
audio = elevenlabs.music.compose(composition_plan=plan, model_id="music_v2_5")

구조 레퍼런스

청크

작곡 계획은 최대 30개 청크의 순서가 있는 목록입니다. 각 청크는 text와 스타일을 기반으로 노래의 한 섹션을 생성합니다. 첫 번째 청크가 가장 중요합니다. 이 청크의 스타일이 노래 전체의 분위기와 장르를 설정합니다.

필드유형설명
textstring대괄호 안의 섹션 이름([Verse 1]), 가사 줄, 중괄호 안의 인라인 지시문({scratching})입니다.
duration_msnumber밀리초 단위 길이(3,000~120,000)입니다.
positive_stylesarray포함할 스타일과 지시문(최대 50개)입니다.
negative_stylesarray피할 스타일과 지시문(최대 50개)입니다. 기본값은 비어 있습니다.
context_adherencestringlow, medium 또는 high(기본값)입니다. 청크가 주변 청크를 얼마나 밀접하게 따르는지 나타냅니다.

노래는 최대 30개 청크로 구성할 수 있습니다. 총 길이는 3초에서 10분 사이여야 하며, 각 청크는 3초에서 120초 사이여야 합니다.

첫 번째 청크의 스타일은 전체 분위기와 장르를 설정하므로 가장 중요합니다. 방향이 정해질 때까지 초기 청크에는 최소 6~7개의 스타일을 사용하세요. “great production quality” 같은 일반적인 스타일은 목록에 추가하기 좋은 기본값입니다.

청크는 저장된 노래의 오디오를 참조하여 기존 섹션을 변경 없이 유지하거나 새 오디오의 조건으로 사용할 수도 있습니다. 기존 노래를 편집하고 결합하는 방법은 음악 인페인팅을 참조하세요.

가사 작성

text 필드는 섹션 이름, 가사, 인라인 지시문을 결합합니다.

  • 대괄호 안의 섹션 이름: [Verse 1], [Chorus], [Bridge]
  • 줄 바꿈(\n)으로 각 줄을 구분한 일반 텍스트 가사
  • 괄호 안의 음성적 소리: (hmmm hmmm), (ooh), (yeah)
  • 중괄호 안의 인라인 지시문: {guitar solo}, {scratching}, {instrumental break}

짧은 인라인 큐에는 중괄호를 사용하세요. 전체 청크에 적용되는 광범위한 특성(장르, 악기 구성 또는 전반적인 보컬 스타일)에는 positive_styles를 사용하세요.

{
"text": "[Verse]\n(soft female vocals) I've been waiting\n(instrumental break)\nfor you"
}

수정된 예제에서는 전반적인 보컬 스타일을 positive_styles로 옮기고, 짧은 인라인 큐는 괄호 대신 중괄호를 사용해 text에 유지합니다.

스타일 팁

스타일 설명자는 구체적으로 작성하세요.

{
"positive_styles": [
"warm acoustic guitar with light fingerpicking",
"soft female vocals with intimate delivery",
"gentle percussion with brushed snare",
"80 BPM"
]
}

원하지 않는 소리를 방지하려면 네거티브 스타일을 적극적으로 사용하세요. 스타일은 영어여야 합니다(가사는 모든 언어를 사용할 수 있음).

스타일에 저작권이 있는 콘텐츠를 포함하면 API가 추천 대안과 함께 bad_composition_plan 오류를 반환합니다. 저작권 자료 처리를 참조하세요.

예제

시네마틱 인스트루멘털

{
"chunks": [
{
"text": "[Tension Build]",
"duration_ms": 15000,
"positive_styles": [
"cinematic",
"orchestral",
"epic",
"low strings tremolo",
"building intensity",
"80 BPM",
"D minor"
],
"negative_styles": ["vocals", "lyrics", "pop", "electronic", "bright"],
"context_adherence": "high"
},
{
"text": "[Climax]",
"duration_ms": 15000,
"positive_styles": ["full orchestra", "brass fanfare", "triumphant"],
"negative_styles": ["quiet", "vocals"],
"context_adherence": "high"
},
{
"text": "[Resolution]",
"duration_ms": 10000,
"positive_styles": ["gentle strings", "piano melody", "fading out"],
"negative_styles": ["intense", "vocals"],
"context_adherence": "high"
}
]
}

보이스오버가 포함된 광고

{
"chunks": [
{
"text": "[Intro]",
"duration_ms": 5000,
"positive_styles": [
"upbeat",
"modern pop",
"energetic",
"120 BPM",
"instrumental",
"catchy hook"
],
"negative_styles": ["sad", "slow", "dark", "vocals"],
"context_adherence": "high"
},
{
"text": "[Voiceover]\nIntroducing the future of productivity\nWork smarter, not harder",
"duration_ms": 10000,
"positive_styles": ["spoken voiceover", "confident male voice", "background music"],
"negative_styles": ["singing"],
"context_adherence": "high"
},
{
"text": "[Outro]",
"duration_ms": 5000,
"positive_styles": ["musical sting", "memorable"],
"negative_styles": ["vocals"],
"context_adherence": "high"
}
]
}

다음 단계