ferraus midi trim
Keep a time range
Synopsis
ferraus midi trim <input> [options] [-o <output>]
What it does
Keeps events inside --range (beats like 4b..12b are musical; seconds follow the tempo map). Notes crossing the edges are clipped; the tempo, signatures, programs, and controller values in effect at the start are kept.
Examples
Keep beats 16 to 48 (bars 5-12 in 4/4)
ferraus midi trim song.mid --range 16b..48b -o chorus.mid
Drop the first 30 seconds
ferraus midi trim song.mid --range 0:30..end -o tail.mid
Keep 10 to 20 seconds at their original position in time
ferraus midi trim song.mid --range 10s..20s --shift off -o ten.mid
Options
| Flag | Type | Default | Meaning |
|---|---|---|---|
--range | range | — | start..end in beats (8b..24b), seconds (10s..30s), or mm:ss; end = file end Required. |
--shift | on|off | on | Move the range start to time zero |
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.
For models
- MCP tool:
ferraus_midi_trim - Schema:
ferraus schema midi trim - Pipeline:
{ op: midi trim, args: { ... } }(flag names with_instead of-) - fx stage: no
{"command": "midi trim", "defaults": {"shift": "on"}}