音訊
產生 Runway 音效
使用 Runway API 從文字 Prompt 產生音效或音訊場景。
POST
/
runwayml
/
v1
/
sound_effect
curl https://api.cometapi.com/runwayml/v1/sound_effect \
--request POST \
--header "Authorization: Bearer $COMETAPI_KEY" \
--header "Content-Type: application/json" \
--data '{
"model": "eleven_text_to_sound_v2",
"promptText": "Gentle rain falling on a wooden roof with distant thunder.",
"duration": 5.5,
"loop": true
}'{
"id": "123e4567-e89b-42d3-a456-426614174000"
}{
"code": "<string>",
"message": "<string>",
"data": "<unknown>"
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>"
}
}使用
對於
對於三個速率控制項,請省略該欄位或使用
POST /runwayml/v1/sound_effect 從文字 Prompt 建立音訊任務。
使用 Bearer 驗證傳送 CometAPI API 金鑰和 JSON 請求主體。
選擇模型
| 模型 ID | 必要輸入 | 選用控制項 |
|---|---|---|
eleven_text_to_sound_v2 | promptText 長度為 1–3000 個字元 | duration 從 0.5 到 30 秒,包含小數秒; loop |
seed_audio | promptText 長度為 1–2048 個字元 | 最多三個 referenceAudios;語音、音量和音高控制項;輸出格式 |
eleven_text_to_sound_v2,請省略 duration,以從
Prompt 選擇長度。設定 loop: true 以要求重複播放的音效。
對於 seed_audio,請在 Prompt 中依陣列順序將 referenceAudios 參照為 @Audio1、@Audio2,
以及 @Audio3。不需要參照時,請省略 referenceAudios。
將每個範例音訊 URL 替換為可存取的音訊檔案 HTTPS URL。
請勿在此端點上搭配此模型包含 duration、loop 或 voice。
設定音訊控制項
| 欄位 | 值 | 含義 |
|---|---|---|
speechRate | 介於 -50 到 100 的整數 | 負值會減慢語速;正值會加快語速。 |
loudnessRate | 介於 -50 到 100 的整數 | 負值會降低音量;正值會提高音量。 |
pitchRate | 介於 -12 到 12 的整數 | 以半音為單位的音高偏移。 |
sampleRate | 8000, 16000, 24000, 32000, 44100, 48000 | 以 Hz 為單位的音訊取樣率。 |
outputFormat | wav, mp3, ogg_opus | 輸出音訊格式。 |
0 以保留其正常值。
擷取結果
儲存傳回的id,然後使用 取得 Runway 任務
以擷取任務狀態。當 status 為 SUCCEEDED 時,讀取
output中的音訊 URL。如果任務失敗,請檢查 failure 和 failureCode。主體
application/json
- eleven_text_to_sound_v2
- seed_audio
Request settings for eleven_text_to_sound_v2.
回應
Task created. Save the returned id to retrieve task status.
最後修改於 2026年9月22日
⌘I
curl https://api.cometapi.com/runwayml/v1/sound_effect \
--request POST \
--header "Authorization: Bearer $COMETAPI_KEY" \
--header "Content-Type: application/json" \
--data '{
"model": "eleven_text_to_sound_v2",
"promptText": "Gentle rain falling on a wooden roof with distant thunder.",
"duration": 5.5,
"loop": true
}'{
"id": "123e4567-e89b-42d3-a456-426614174000"
}{
"code": "<string>",
"message": "<string>",
"data": "<unknown>"
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>"
}
}