Edit MIDI notes
midi_editTransform existing MIDI notes with ordered operations such as transpose, quantize, humanize, arpeggiate, and groove, then write a new .mid or update a project file.
Instructions
Transforms notes with an ordered list of operations: transpose (semitones, interval, or to a key), quantize with swing, humanize, change velocity, filter notes, fold into an instrument range, invert or reverse, arpeggiate, and apply the groove of another file; on a .mid file or inline tracks also merge tracks, split a track by pitch, retime, set one tempo and set the program. A project file is rewritten in place (or into 'output'); a .mid file or inline tracks give a new .mid. Use it for any change to existing notes; pass 'track' to touch one track, and drums are skipped by transpose, transform, arpeggiate, foldToRange, splitByPitch and setProgram. Track, tempo and program changes on a project belong to project_edit (addTrack, setTempoSegments, setProgram). Not for reading (use midi_read). Example: {"source": "song.mid", "ops": [{"op": "transpose", "shift_semitones": -2}, {"op": "quantize", "grid": "1/16", "strength_ratio": 0.8}]}.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"source": "<source>",
"ops": "<ops>"
},
"name": "midi_edit"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ops | Yes | Operations applied in order, each an object with an 'op' name plus its fields (1-64). Drum tracks are skipped by transpose, transform, arpeggiate, foldToRange, splitByPitch and setProgram. mergeTracks, splitByPitch, retime, setTempo and setProgram need a .mid file or inline tracks. | |
| track | No | Edit only this track: its id (integer from 1) or its unique name. Omit to edit every track. | |
| detail | No | 'concise' returns the summary and the most useful fields; 'full' returns all. | concise |
| output | No | Output .mid path. Omit to auto-name a file in the output directory. | |
| source | Yes | What to edit. A .mid file or inline tracks give a new .mid; a project file is rewritten in place (or into 'output', a .sonare.json) and each edited track must have one MIDI clip. A .mid/.midi file path, a project file path (.sonare.json) or inline tracks [{name?, program?, channel?, is_drum?, notes: [{pitch, start_ppq, length_ppq, velocity}]}]. Track ids of a file are the core's (1, 2, ...); inline tracks count from 1. | |
| dry_run | No | Report what would be written, with the planned path, only. | |
| overwrite | No | Replace an existing file at 'output' (default false). |