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

FlagTypeDefaultMeaning
--freqtextautoHum fundamental in Hz (50Hz, 60Hz, 59.94Hz) or 'auto' to detect 50 or 60 Hz
--harmonicsinteger8Number of harmonics to notch, counting the fundamental Range: 1..32.
--qnumber30Notch quality factor (centre frequency / bandwidth); higher is narrower
--depthgain-40dBMinimum attenuation of each hum line in dB
--slopegain-3dBDepth change per harmonic in dB (negative cuts higher harmonics deeper)
--trackon|offonFollow slow drift of the mains frequency over time (on|off)
--residualpath—Also write the removed hum to this file
--mixpercent100%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

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.
  • Gains need a unit when not in dB: 0.5x is a factor, -6 and -6dB are 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%"}}