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

FlagTypeDefaultMeaning
--rangerange—start..end in beats (8b..24b), seconds (10s..30s), or mm:ss; end = file end Required.
--shifton|offonMove 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

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.

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"}}