set_tempo
Adjust the tempo of an Ableton Live session directly by specifying the desired BPM through the MCP server, enabling precise control over your music production workflow.
Instructions
Set the tempo of the Ableton session.
Parameters:
tempo: The new tempo in BPM
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tempo | Yes |
Implementation Reference
- MCP_Server/server.py:393-407 (handler)MCP tool handler for 'set_tempo'. Connects to Ableton remote script and sends the set_tempo command with the given tempo value.@mcp.tool() def set_tempo(ctx: Context, tempo: float) -> str: """ Set the tempo of the Ableton session. Parameters: - tempo: The new tempo in BPM """ try: ableton = get_ableton_connection() result = ableton.send_command("set_tempo", {"tempo": tempo}) return f"Set tempo to {tempo} BPM" except Exception as e: logger.error(f"Error setting tempo: {str(e)}") return f"Error setting tempo: {str(e)}"
- Low-level implementation in Ableton remote script that directly sets the song's tempo using the Live Python API (self._song.tempo = tempo). Called by the MCP server via socket command.def _set_tempo(self, tempo): """Set the tempo of the session""" try: self._song.tempo = tempo result = { "tempo": self._song.tempo } return result except Exception as e: self.log_message("Error setting tempo: " + str(e)) raise
- Command dispatching logic in the remote script's _process_command method that routes 'set_tempo' commands to the _set_tempo handler.elif command_type == "set_tempo": tempo = params.get("tempo", 120.0) result = self._set_tempo(tempo)
- MCP_Server/server.py:394-400 (schema)Function signature and docstring defining the input schema (tempo: float) and output (str) for the MCP tool.def set_tempo(ctx: Context, tempo: float) -> str: """ Set the tempo of the Ableton session. Parameters: - tempo: The new tempo in BPM """