Midi Read
midi_readReads a Standard MIDI File to list its tempo, meter, markers, tracks and channels, or imports its notes, pitch bend, controllers and MPE into a project's tracks.
Instructions
Read a Standard MIDI File (.mid, from a DAW, a score program or the web). Without into, it lists what the
file holds: tempo and meter (and any changes), markers, and every track and channel with its note count, range
and bars. With into={: } it writes those notes into existing tracks (track_add first),
where is the track's name, '#', or 'ch<1-16>' (that channel across the file, e.g. 'ch10' for
drums). bar: where the file's bar 1 lands. mode='replace' clears the span the notes cover on each target first,
'add' merges. quantize: a grid in beats (0.25 = 16ths) the starts snap to; default keeps them as played.
Positions are read in beats, so a file at another tempo keeps its bars at this project's tempo (the reply says
when the tempos differ).
Pitch bend and controllers in the part become the target's expression lanes (automation inst.lane.,
which a performer voice plays): pitch bend -> bend (semitones, at the file's RPN 0 bend range, else +-2), cc:1
-> vib (0..50 cents), cc:11 -> level (-40..0 dB), cc:2 -> breath (0..1); the reply names the messages no lane
took. lanes: the map as data, as midi_write takes it ({lane: {'midi': 'bend' | 'pressure' | 'cc:', 'range':
[lo, hi]}}, {lane: None} skips one), e.g. {'mute': {'midi': 'cc:20', 'range': [0, 1]}}. An MPE part (the file
configures MPE with RPN 6 in any track, lower or upper zone, sized as it says, or mpe=True, 'lower' or 'upper'
for a file that does not say; mpe=False reads it as one plain part, every channel's messages into one lane) is
read per note, in the configuration in force at its first note (the reply warns when it changes while the
part plays), its zone's member channels only; a part on a zone's master channel or outside every zone is a
plain part. Bend at +-48
unless the file says, and per-note pressure -> level; a lane follows the newest note still sounding, since
ismail's lanes are per track. Poly pressure (one key's own) is read the same way, as its channel's pressure
following the newest key still held, onto the lane that takes pressure (lanes={'level': {'midi': 'pressure',
'range': [-40, 0]}} on a plain part; a channel that sends channel pressure too keeps its own); the reply says
so. Lanes replace the target's points over the span they cover; quantize moves notes only. Reach for it when the person brings a .mid (from their DAW, a score program or the web) to open, read or
import into a song, its pitch bend, mod wheel, other controllers and MPE included. The listing names each
track's GM program (1 to 128); into= writes notes and lanes, not programs (a track's sound is its instrument).
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": {
"project": "<project>",
"file": "<file>"
},
"name": "midi_read"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| bar | No | ||
| mpe | No | ||
| file | Yes | ||
| into | No | ||
| mode | No | replace | |
| lanes | No | ||
| project | Yes | ||
| quantize | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |