ferraus midi quantize

Snap notes to a grid

Synopsis

ferraus midi quantize <input> [options] [-o <output>]

What it does

Maps notes to ticks against the file's tempo map and moves each note-on by strength × (nearest grid point − onset). The grid is ppq × 4 / subdivision ticks (1/8T triplets and 1/8D dotted supported); --swing delays every second grid point by swing × grid; --groove replaces the fixed grid with per-position offsets and velocity deltas from 'midi groove extract'. --humanize adds seeded Gaussian jitter afterwards (--seed).

Examples

Snap every note-on to the nearest sixteenth

ferraus midi quantize take.mid --grid 1/16 -o tight.mid

Pull notes 80% of the way to a swung sixteenth grid

ferraus midi quantize take.mid --grid 1/16 --strength 80% --swing 60% -o swung.mid

Give a stiff part the feel captured from a drummer

ferraus midi quantize part.mid --groove groove.json -o grooved.mid

Options

FlagTypeDefaultMeaning
--gridgrid1/16Grid step: 1/16, 1/8T (triplet), 1/8D (dotted), or auto to detect the dominant subdivision
--strengthpercent100%How far notes move toward the grid: 100% lands exactly on it, 50% halves the error Range: 0..100%.
--swingpercent0%Delay of every second grid point as a percentage of one grid step (60% = 0.6 × 1/16) Range: 0..100%.
--whatstart | end | both | durationstartstart: snap note-ons, note-offs follow (durations kept); end: snap note-offs only; both: snap each independently; duration: snap note-ons and round lengths to whole grid steps
--humanizetime0msStandard deviation of Gaussian timing jitter added after quantizing (15ms); reproducible with --seed
--min-lengthgrid1/64Notes shorter than this note value after quantizing are lengthened to it
--no-overlapon|offonShorten notes that overlap the next note of the same pitch and channel; drop exact duplicates
--groovepath—Groove file from 'midi groove extract'; replaces --grid and --swing
--trackslist—1-based track numbers to change, comma separated (default: every track)

Global options

Every command also accepts the global options (-o, --json, --dry-run, --overwrite, --progress, ...). See Global options.

Exit codes

CodeMeaning
0Success
1Processing failed
2Usage or parameter error
3Input missing or unreadable
8Cancelled
70Internal error (bug)

Common mistakes

  • Forgetting that outputs are never overwritten: pass --overwrite or a new -o path when re-running.
  • Beat-based times (4b, 1/4) need a tempo: pass --bpm or write 4b@120.
  • Percentages accept 80% or the fraction 0.8; a bare 80 means 80x, not 80%.

For models

  • MCP tool: ferraus_midi_quantize
  • Schema: ferraus schema midi quantize
  • Pipeline: { op: midi quantize, args: { ... } } (flag names with _ instead of -)
  • fx stage: no
{"command": "midi quantize", "defaults": {"grid": "1/16", "strength": "100%", "swing": "0%", "what": "start", "humanize": "0ms", "min_length": "1/64", "no_overlap": "on"}}