Add audio track
add_audioAdd a music track or sound effect that plays as a project-level audio layer over all clips. Does NOT consume a clip slot. Use this for background music or a soundtrack that should play under the existing timeline. (For inserting an audio file as its own sequential clip with auto-transcription, use add_clips(kind='video') with an audio mime_type instead.)
type="music": requires src, name, source_duration.
srcis either thesrcfrom a find(type='music') result, or an mcp_upload_id (prefixedmup_) from upload_file — upload ids resolve to a presigned URL server-side. For a Freesound result thesrcis an opaque handle; pass it through unchanged and Clueso downloads + hosts the original server-side (do not try to fetch it yourself). Getsource_durationfrom the find result, or from analyze_audio mode='features' (data.duration_ms / 1000). Optional: guide_start_time, guide_end_time, music_start_time, music_end_time (trim the source track), volume, loop, fade_in, fade_out.type="sfx": pass the
src,name, andsource_durationfrom a find(type='sfx') result, plus guide_start_time (Freesoundsrcis an opaque handle, resolved server-side just like music). Optional: volume. (Legacy: a fixed-librarysfx_keylike 'whoosh' still works instead of src.)
Concurrency: whole-project mutation (conflict domain: the entire project) — serialize; do not run in parallel with ANY other mutation on the same project_id (including element/voiceover edits). Size your clips BEFORE calling add_audio, or pass guide_end_time explicitly — the default ('end of project') is captured at call time and will NOT auto-extend if clips are added or resized afterwards.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| src | No | Audio source. For type='music' (required) or a stock type='sfx': the `src` from a find(type='music'|'sfx') result (may be an opaque Freesound handle — pass as-is), or an mcp_upload_id (prefixed 'mup_') from upload_file. Not needed for legacy fixed-library sfx (use sfx_key). | |
| loop | No | Loop the track if project is longer than the source. Music only. (default: false) | |
| name | No | Track/effect name. From the find result, or any descriptive label when using mcp_upload_id. Required for type='music' and for stock type='sfx' (passed via src). | |
| type | Yes | Audio type: 'music' or 'sfx' | |
| volume | No | Volume as percent (0–100). Default: 50 for music, 80 for sfx. | |
| fade_in | No | Fade-in duration in seconds. Music only. (default: 0.5) | |
| sfx_key | No | LEGACY fixed-library SFX key (e.g. 'whoosh', 'pop', 'click'). Optional alternative to src for type='sfx'. Prefer the src/name/source_duration from a find(type='sfx') result. | |
| fade_out | No | Fade-out duration in seconds. Music only. (default: 0.5) | |
| project_id | Yes | The project ID | |
| guide_end_time | No | When to stop playing (seconds). Music only. Default = end of project AT CALL TIME — captured once at insert and NOT recomputed when clips are later added or resized. Pass an explicit value (e.g. the intended final project duration) when adding audio before clips are sized. | |
| music_end_time | No | Out-point within the SOURCE track (seconds) — trims where playback ends in the music file. Music only. Default = source_duration. | |
| source_duration | No | Source duration in seconds. From the find result, or analyze_audio mode='features' (data.duration_ms / 1000). Required for type='music' and for stock type='sfx' (passed via src). | |
| guide_start_time | No | When to start playing in the guide timeline (seconds). Required for type='sfx', optional for music (default 0). | |
| music_start_time | No | In-point within the SOURCE track (seconds) — trims where playback begins in the music file. Music only. Default 0 (start of source). |