producer_swap_vocals
Replace vocals in a base audio track with vocals from another track to create vocal mashups and remixes.
Instructions
Swap the vocals of one song with vocals from another song.
Takes the instrumental track from the base audio and combines it with
the vocal track from the swap audio.
Use this when:
- You want to combine vocals from one song with instrumentals from another
- You want to hear how different vocals sound over the same beat
- You're creating a vocal mashup
Returns:
Task ID and the swapped audio information.Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| audio_id | Yes | ID of the base audio whose vocals will be replaced. | |
| swap_audio_id | Yes | ID of the audio whose vocals to use as replacement. | |
| callback_url | No | Webhook callback URL for asynchronous notifications. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- tools/audio_tools.py:312-346 (handler)The `producer_swap_vocals` async function is the handler for swapping vocals between two songs. It is decorated with @mcp.tool(), takes audio_id (base audio), swap_audio_id (vocals source), and optional callback_url parameters. It calls client.generate_audio with action='swap_vocals' and returns the formatted JSON result via format_audio_result.
@mcp.tool() async def producer_swap_vocals( audio_id: Annotated[ str, Field(description="ID of the base audio whose vocals will be replaced."), ], swap_audio_id: Annotated[ str, Field(description="ID of the audio whose vocals to use as replacement."), ], callback_url: Annotated[ str | None, Field(description="Webhook callback URL for asynchronous notifications."), ] = None, ) -> str: """Swap the vocals of one song with vocals from another song. Takes the instrumental track from the base audio and combines it with the vocal track from the swap audio. Use this when: - You want to combine vocals from one song with instrumentals from another - You want to hear how different vocals sound over the same beat - You're creating a vocal mashup Returns: Task ID and the swapped audio information. """ result = await client.generate_audio( action="swap_vocals", audio_id=audio_id, swap_audio_id=swap_audio_id, callback_url=callback_url, ) return format_audio_result(result) - tools/audio_tools.py:314-326 (schema)Input parameters for producer_swap_vocals: audio_id (str, the base audio whose vocals will be replaced), swap_audio_id (str, the audio whose vocals to use as replacement), and callback_url (optional str, webhook URL).
audio_id: Annotated[ str, Field(description="ID of the base audio whose vocals will be replaced."), ], swap_audio_id: Annotated[ str, Field(description="ID of the audio whose vocals to use as replacement."), ], callback_url: Annotated[ str | None, Field(description="Webhook callback URL for asynchronous notifications."), ] = None, ) -> str: - tools/audio_tools.py:312-313 (registration)The tool is registered via the @mcp.tool() decorator on the producer_swap_vocals function. 'mcp' is a FastMCP instance defined in core/server.py.
@mcp.tool() async def producer_swap_vocals( - main.py:198-201 (registration)The tool name 'producer_swap_vocals' is listed in the server capabilities/tools list in main.py with description 'Swap vocals between two songs'.
{ "name": "producer_swap_vocals", "description": "Swap vocals between two songs", }, - core/utils.py:81-94 (helper)The format_audio_result function is a helper that formats the API response as JSON with async submission guidance (polling instructions for producer_get_task).
def format_audio_result(data: dict[str, Any]) -> str: """Format audio generation result as JSON. Args: data: API response dictionary Returns: JSON string representation of the result """ return json.dumps( _with_submission_guidance(data, "producer_get_task", "producer_get_tasks_batch"), ensure_ascii=False, indent=2, )