create_clip
Create a new MIDI clip in Ableton Live by specifying track and clip slot indices, with customizable length for music production.
Instructions
Create a new MIDI clip in the specified track and clip slot.
Parameters:
track_index: The index of the track to create the clip in
clip_index: The index of the clip slot to create the clip in
length: The length of the clip in beats (default: 4.0)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| track_index | Yes | ||
| clip_index | Yes | ||
| length | No |
Implementation Reference
- The actual Ableton Live API implementation for creating a clip in a specific track/slot.
def _create_clip(self, track_index, clip_index, length): """Create a new MIDI clip in the specified track and clip slot""" try: if track_index < 0 or track_index >= len(self._song.tracks): raise IndexError("Track index out of range") track = self._song.tracks[track_index] if clip_index < 0 or clip_index >= len(track.clip_slots): raise IndexError("Clip index out of range") clip_slot = track.clip_slots[clip_index] # Check if the clip slot already has a clip if clip_slot.has_clip: raise Exception("Clip slot already has a clip") # Create the clip clip_slot.create_clip(length) - MCP_Server/server.py:282-300 (handler)The MCP tool handler for create_clip, which invokes the command in the Remote Script.
def create_clip(ctx: Context, track_index: int, clip_index: int, length: float = 4.0) -> str: """ Create a new MIDI clip in the specified track and clip slot. Parameters: - track_index: The index of the track to create the clip in - clip_index: The index of the clip slot to create the clip in - length: The length of the clip in beats (default: 4.0) """ try: _run("create_clip", { "track_index": track_index, "clip_index": clip_index, "length": length }) return f"Created clip at track {track_index}, slot {clip_index} ({length} beats)" except Exception as e: return f"Error creating clip: {e}"