piano_roll_write_patterns
Write notes to multiple channels and patterns sequentially, with optional clearing and final restore. Solves bulk piano roll editing by avoiding repeated navigation between writes.
Instructions
Write notes to multiple channel × pattern pairs sequentially, restoring only at the end.
Mirrors piano_roll_read_patterns_autolocate: iterates through all writes in order without jumping back between each one, then restores to the original pattern/channel once at the very end.
Args: writes: List of {channel: int, pattern: int, notes: [...], current_note_count?: int}. Supply current_note_count from a prior read sweep to skip force_retarget for non-empty patterns. Omit or set to 0/None to always force_retarget (safe default). clear_first: Clear each pattern before writing (default True). restore_start: Restore the original pattern/channel after all writes (default False — stays on last edited).
Returns: {results: [{channel, pattern, ok, note_count, hotkey_sent}], restored}
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| writes | Yes | ||
| clear_first | No | ||
| restore_start | No |