insert_midi_file
Insert a .mid file from disk onto a track at a chosen position. Overwrites existing items only when replace_existing_in_range is enabled.
Instructions
Insert a .mid file from disk onto a track at a position. Write the MIDI yourself, then insert. Never overwrites existing items unless replace_existing_in_range is true. Use this when a .mid file already exists; to build MIDI from a list of notes use insert_midi_events, for humanized drums insert_groove, for guitar or bass insert_riff.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| loop | No | ||
| track | No | Exact track name (case-insensitive); "master" targets the master track. Used when no GUID is given; errors if two tracks share the name. | |
| length | No | {type: bars|region|time_selection|seconds|as_generated, ...} | |
| dry_run | No | Preview: return what would run without changing the project. | |
| position | No | Position object, e.g. {"type":"cursor"}, {"type":"bar","bar":33}, {"type":"time","seconds":12.5}, {"type":"marker","name":"Chorus"}, {"type":"region","name":"Verse 1"}, {"type":"time_selection"} | |
| midi_path | Yes | Absolute path to the .mid file. | |
| track_contains | No | Case-insensitive substring; used only when no GUID or exact name is given. Errors if it matches more than one track. | |
| target_track_guid | No | Stable REAPER track GUID; preferred when available. Wins over every other track selector. | |
| use_selected_track | No | Target the first selected track; ignored when any other track selector is given. Errors if nothing is selected. | |
| replace_existing_in_range | No |