ferraus trim

Keep one time range of the input

Synopsis

ferraus trim <input> [options] [-o <output>]

What it does

Keeps the part of the input between the two ends of --range and drops the rest. By default each cut point moves to the nearest zero crossing (within 5 ms) so the new edges start and stop cleanly without a click; use --snap off for exact sample positions. --pad adds silence around the result. Times accept seconds, mm:ss, samples, beats (with --bpm), and negative values counted from the end.

This command is also an fx stage and a pipeline op: ferraus fx in.wav -o out.wav --fx "trim:key=value".

Examples

Keep 0:30 to 1:15, with click-free edges

ferraus trim song.wav --range 0:30..1:15 -o chorus.wav

Drop the first 2.5 seconds and add a quarter second of silence at each end

ferraus trim take.wav --range 2.5s..end --pad 250ms -o take_clean.wav

Keep exactly four bars at 128 BPM, sample-accurate

ferraus trim loop.wav --range 0b..16b --bpm 128 --snap off -o loop4bars.wav

Options

FlagTypeDefaultMeaning
--rangerange—Range to keep as start..end, e.g. 0s..30s, 1:00..end, -10s..end, 8b..24b Required.
--padtime—Silence added to both ends of the result (duration, e.g. 500ms); --pad-start/--pad-end override one side
--pad-starttime—Silence added before the result (duration, e.g. 1s)
--pad-endtime—Silence added after the result (duration, e.g. 2s)
--snapzero | offzerozero: move cut points to the nearest zero crossing so the edges never click; off: cut at the exact sample
--snap-windowtime5msHow far (duration) a cut point may move when snapping to a zero crossing

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
4Unsupported format or codec
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_trim
  • Schema: ferraus schema trim
  • Pipeline: { op: trim, args: { ... } } (flag names with _ instead of -)
  • fx stage: yes
{"command": "trim", "defaults": {"snap": "zero", "snap_window": "5ms"}}