add_notes_to_clip
Add MIDI notes to a clip in Ableton Live by specifying track index, clip index, and note parameters including pitch, timing, and velocity.
Instructions
Add MIDI notes to a clip.
Parameters:
track_index: The index of the track containing the clip
clip_index: The index of the clip slot containing the clip
notes: List of note dicts with pitch, start_time, duration, velocity, mute
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| track_index | Yes | ||
| clip_index | Yes | ||
| notes | Yes |
Implementation Reference
- The actual implementation of adding notes to a clip within the Ableton Live remote script environment.
def _add_notes_to_clip(self, track_index, clip_index, notes): """Add MIDI notes to a clip""" 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] if not clip_slot.has_clip: raise Exception("No clip in slot") clip = clip_slot.clip # Convert note data to Live's format live_notes = [] for note in notes: pitch = note.get("pitch", 60) start_time = note.get("start_time", 0.0) duration = note.get("duration", 0.25) velocity = note.get("velocity", 100) mute = note.get("mute", False) live_notes.append((pitch, start_time, duration, velocity, mute)) # Add the notes - MCP_Server/server.py:304-320 (handler)The MCP server tool definition that calls the remote script command.
def add_notes_to_clip(ctx: Context, track_index: int, clip_index: int, notes: List[Dict[str, Union[int, float, bool]]]) -> str: """ Add MIDI notes to a clip. Parameters: - track_index: The index of the track containing the clip - clip_index: The index of the clip slot containing the clip - notes: List of note dicts with pitch, start_time, duration, velocity, mute """ try: _run("add_notes_to_clip", { "track_index": track_index, "clip_index": clip_index, "notes": notes }) return f"Added {len(notes)} notes to track {track_index}, slot {clip_index}"