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
| Flag | Type | Default | Meaning |
|---|---|---|---|
--grid | grid | 1/16 | Grid step: 1/16, 1/8T (triplet), 1/8D (dotted), or auto to detect the dominant subdivision |
--strength | percent | 100% | How far notes move toward the grid: 100% lands exactly on it, 50% halves the error Range: 0..100%. |
--swing | percent | 0% | Delay of every second grid point as a percentage of one grid step (60% = 0.6 × 1/16) Range: 0..100%. |
--what | start | end | both | duration | start | start: 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 |
--humanize | time | 0ms | Standard deviation of Gaussian timing jitter added after quantizing (15ms); reproducible with --seed |
--min-length | grid | 1/64 | Notes shorter than this note value after quantizing are lengthened to it |
--no-overlap | on|off | on | Shorten notes that overlap the next note of the same pitch and channel; drop exact duplicates |
--groove | path | — | Groove file from 'midi groove extract'; replaces --grid and --swing |
--tracks | list | — | 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
| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | Processing failed |
| 2 | Usage or parameter error |
| 3 | Input missing or unreadable |
| 8 | Cancelled |
| 70 | Internal error (bug) |
Common mistakes
- Forgetting that outputs are never overwritten: pass
--overwriteor a new-opath when re-running. - Beat-based times (
4b,1/4) need a tempo: pass--bpmor write4b@120. - Percentages accept
80%or the fraction0.8; a bare80means 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"}}