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
| Flag | Type | Default | Meaning |
|---|---|---|---|
--range | range | — | Range to keep as start..end, e.g. 0s..30s, 1:00..end, -10s..end, 8b..24b Required. |
--pad | time | — | Silence added to both ends of the result (duration, e.g. 500ms); --pad-start/--pad-end override one side |
--pad-start | time | — | Silence added before the result (duration, e.g. 1s) |
--pad-end | time | — | Silence added after the result (duration, e.g. 2s) |
--snap | zero | off | zero | zero: move cut points to the nearest zero crossing so the edges never click; off: cut at the exact sample |
--snap-window | time | 5ms | How 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
| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | Processing failed |
| 2 | Usage or parameter error |
| 3 | Input missing or unreadable |
| 4 | Unsupported format or codec |
| 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_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"}}