mcp_opendaw_constrain_note_range
Constrain MIDI notes to a specified pitch range with clamp or octave wrap modes, fixing out-of-range notes after generation or transposition.
Instructions
Constrain notes to a pitch range — clamp or octave-wrap out-of-range notes.
After AI generation, transcription, or aggressive transposition, notes can land outside the playable range of an instrument. This tool brings them back inside.
Two modes:
"clamp" — notes below min_pitch are set to min_pitch, notes above max_pitch are set to max_pitch. Preserves the note but loses pitch information. Use when exact range matters (e.g. MIDI 0-127 safety).
"octave_wrap" — notes are shifted by octaves (±12 semitones) until they fall within [min_pitch, max_pitch]. Preserves pitch class and musical relationship. Use for instrument range constraints (violin, guitar, vocal, flute). If a note can't fit even after wrapping (range < 12 semitones), it's clamped.
Common instrument ranges (MIDI note numbers):
Guitar (standard tuning): E2(40) to E6(88)
Bass guitar: E1(28) to G4(67)
Violin: G3(55) to A7(105)
Cello: C2(36) to C6(84)
Flute: C4(60) to D7(98)
Vocal soprano: C4(60) to A5(81)
Vocal bass: E2(40) to E4(64)
unit_index: AU index (-1 = all AUs). track_index: Note track index (-1 = all note tracks on the AU). region_index: Region index (-1 = all regions on the track). min_pitch: Minimum allowed MIDI pitch (0-127, default 0 = no lower bound). max_pitch: Maximum allowed MIDI pitch (0-127, default 127 = no upper bound). mode: "clamp" (hard limit) or "octave_wrap" (shift by octaves to fit).
Returns per-track notes adjusted, clamped count, wrapped count.
Example:
Constrain to guitar range with octave wrapping
constrain_note_range(unit_index=0, track_index=2, min_pitch=40, max_pitch=88, mode="octave_wrap")
Safety clamp to MIDI range
constrain_note_range(mode="clamp", min_pitch=0, max_pitch=127)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | No | clamp | |
| max_pitch | No | ||
| min_pitch | No | ||
| unit_index | No | ||
| track_index | No | ||
| region_index | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |