Draw MIDI as a piano roll
midi_visualizeDraws MIDI files, project tracks, or inline notes as piano-roll PNGs to inspect arrangements, generated parts, or edits, with optional chord strip and file saving.
Instructions
Draws a MIDI file, a project file's MIDI tracks or inline tracks as a piano-roll PNG: notes as rectangles (pitch up, quarter notes right) colored per track and shaded by velocity, bar lines from the time signatures and an optional chord strip. The reply carries the PPQ and pitch ranges drawn, and 'save' keeps the PNG as a file. Use it to look at an arrangement, a generated part or an edit. Do not use it to list exact notes (midi_read), to analyze harmony (theory_analyze) or to draw audio (audio_visualize). Example: {"source": "song.mid", "range": {"start_ppq": 0, "end_ppq": 32}, "track": "bass"}.
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>"
},
"name": "midi_visualize"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| save | No | Also write the PNG as a new file in the output directory (path in 'files'). | |
| range | No | Draw only this window ({start_ppq, end_ppq}, quarter notes). Omit for the whole piece; a few bars to a few dozen bars read best. | |
| track | No | Draw only this track: its id (integer from 1) or its unique name. Omit to draw every track. | |
| width | No | Image width in pixels (240-1400, default 1200). | |
| detail | No | 'concise' returns the summary and the most useful fields; 'full' returns all. | concise |
| height | No | Image height in pixels (160-1400, default 480). | |
| source | Yes | A .mid/.midi file, a project file (.sonare.json) or inline tracks [{name?, is_drum?, notes: [{pitch, start_ppq, length_ppq, velocity}]}]. Track ids are the core's (1, 2, ...); inline tracks count from 1. | |
| show_chords | No | Draw a chord strip above the roll, read from the drawn tracks' notes. |