ferraus filter
Scientific filters: Butterworth, Chebyshev, Bessel, elliptic
Synopsis
ferraus filter <input> [options] [-o <output>]
What it does
Designs an analog prototype, transforms it to the requested band, maps it to digital with the prewarped bilinear transform, and runs it as a cascade of second-order sections. --freq is the -3 dB point for butterworth and bessel, the passband edge (end of the ripple) for chebyshev1 and elliptic, and the stopband edge for chebyshev2. Band filters take low..high and have twice --order poles. The metrics report the realised response and group delay at a few frequencies.
This command is also an fx stage and a pipeline op: ferraus fx in.wav -o out.wav --fx "filter:key=value".
Examples
Very steep elliptic low-pass
ferraus filter in.wav --design elliptic --type lowpass --freq 4kHz --order 6 -o lp.wav
Phase-friendly Bessel high-pass
ferraus filter in.wav --design bessel --type highpass --freq 40Hz -o hp.wav
Telephone band
ferraus filter in.wav --design chebyshev1 --type bandpass --freq 300Hz..3.4kHz --ripple 1dB -o phone.wav
Options
| Flag | Type | Default | Meaning |
|---|---|---|---|
--design | butterworth | chebyshev1 | chebyshev2 | bessel | elliptic | butterworth | Filter family |
--type | lowpass | highpass | bandpass | bandstop | lowpass | Response type |
--freq | text | auto | Cutoff (1kHz) or band (300Hz..3.4kHz); auto = 8 kHz LP, 80 Hz HP, 300 Hz-3.4 kHz BP, 50-70 Hz BS |
--order | integer | 4 | Prototype order (steepness) Range: 1..24. |
--ripple | gain | 0.5dB | Passband ripple in dB (chebyshev1, elliptic) |
--stopband | gain | 60dB | Stopband attenuation in dB (chebyshev2, elliptic) |
--mix | percent | 100% | Dry/wet balance: 0% returns the input unchanged, 100% is fully processed |
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. - Gains need a unit when not in dB:
0.5xis a factor,-6and-6dBare decibels.
For models
- MCP tool:
ferraus_filter - Schema:
ferraus schema filter - Pipeline:
{ op: filter, args: { ... } }(flag names with_instead of-) - fx stage: yes
{"command": "filter", "defaults": {"design": "butterworth", "type": "lowpass", "freq": "auto", "order": "4", "ripple": "0.5dB", "stopband": "60dB", "mix": "100%"}}