piano_roll_write_pattern
Write MIDI notes to a specific FL Studio channel and pattern by auto-switching to the target, clearing prior notes, and optionally restoring the starting position after writing.
Instructions
Write notes to a specific channel × pattern using autolocate-style switching.
Mirrors piano_roll_read_patterns_autolocate: switches to the target pattern via patterns.select (no openEventEditor, no visual flicker), selects the channel, then stages a clear+add_notes action sequence and fires Cmd+Opt+Y.
Args: channel: Channel rack index (0-based). pattern: Pattern index (1-based, as returned by patterns.list). notes: List of notes with midi, time_bars, duration_bars, velocity. clear_first: Clear the pattern before writing (default True). restore_start: Restore the original pattern/channel when done (default False — stays on last edited).
Returns: {ok, note_count, hotkey_sent, restored}
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| notes | Yes | ||
| channel | Yes | ||
| pattern | Yes | ||
| clear_first | No | ||
| restore_start | No |