insert_midi_events
Insert a new MIDI item from raw events (notes, CC, pitch bend, program change) with exact timing and no humanizing. Specify events in seconds from item start.
Instructions
Create a new MIDI item on one track from a list of raw events (notes, CC, pitch bend, program change), with no humanizing. Use this for exact, hand-specified MIDI; use insert_midi_file when a .mid already exists, insert_groove for humanized drums, insert_riff for humanized guitar or bass, cut_band for a whole four-track jam. Event times are seconds from the item start. For drums, keep the golden rule yourself: no drum hits the same velocity twice in a row. Returns {track_guid, notes, controls, start_seconds, length_seconds}. Errors: BAD_PAYLOAD (an event is out of range; nothing is written), INSERT_FAILED / VERIFY_FAILED (the new item is deleted again). Undoable.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| 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. | |
| events | Yes | 1..10000 events. Each needs type and time; the other fields depend on type. | |
| dry_run | No | Preview: return what would run without changing the project. | |
| start_seconds | Yes | Project time in seconds where the new item starts. | |
| length_seconds | Yes | Item length in seconds; every event must fit inside it. | |
| 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. |