ferraus dehum
Remove mains hum (50/60 Hz) and its harmonics
Synopsis
ferraus dehum <input> [options] [-o <output>]
What it does
Detects the mains frequency (50 or 60 Hz) from the spectrum, measures it precisely, follows its slow drift, and removes it with a cascade of narrow notches at the fundamental and its harmonics. --depth is the attenuation floor: each notch centre is cut 6 dB deeper than --depth so small frequency drift stays below it. --slope makes each higher harmonic's notch that much deeper (negative) or shallower (positive). --residual writes the removed hum to a file.
This command is also an fx stage and a pipeline op: ferraus fx in.wav -o out.wav --fx "dehum:key=value".
Examples
Detect and remove hum automatically
ferraus dehum interview.wav -o clean.wav
Remove 50 Hz hum and 12 harmonics and keep what was removed
ferraus dehum gtr.wav --freq 50Hz --harmonics 12 --residual hum.wav -o clean.wav
Very narrow, fixed 60 Hz notches for hum that does not drift
ferraus dehum field.wav --freq 60Hz --track off --q 50 -o clean.wav
A deeper cut with the same depth on every harmonic, for a buzzy amplifier
ferraus dehum amp.wav --depth -60dB --slope 0dB -o clean.wav
Options
| Flag | Type | Default | Meaning |
|---|---|---|---|
--freq | text | auto | Hum fundamental in Hz (50Hz, 60Hz, 59.94Hz) or 'auto' to detect 50 or 60 Hz |
--harmonics | integer | 8 | Number of harmonics to notch, counting the fundamental Range: 1..32. |
--q | number | 30 | Notch quality factor (centre frequency / bandwidth); higher is narrower |
--depth | gain | -40dB | Minimum attenuation of each hum line in dB |
--slope | gain | -3dB | Depth change per harmonic in dB (negative cuts higher harmonics deeper) |
--track | on|off | on | Follow slow drift of the mains frequency over time (on|off) |
--residual | path | — | Also write the removed hum to this file |
--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_dehum - Schema:
ferraus schema dehum - Pipeline:
{ op: dehum, args: { ... } }(flag names with_instead of-) - fx stage: yes
{"command": "dehum", "defaults": {"freq": "auto", "harmonics": "8", "q": "30", "depth": "-40dB", "slope": "-3dB", "track": "on", "mix": "100%"}}