Remove Hum from Audio
Operator: Abdulla Al Fahad. How tools are built and checked
Mains hum, the steady buzz at 50 or 60 Hz and its multiples that a ground loop, a cheap power adapter or a transformer behind the wall puts into a recording, appears in a spectrum as narrow spikes. This page finds the hum from the spectrum, removes it with one narrow notch per harmonic and draws before and after on one chart, so you can watch the spikes go instead of trusting your ears alone. As an illustration, in a 20-second recording built to mimic a voice taken next to mains wiring (noise, a 440 Hz tone and a 50.07 Hz hum), the spikes at 50, 100 and 150 Hz stand 7.6, 17.9 and 11.7 dB above the noise around them; after the notches they sit 4.5, 3.5 and 5.0 dB below it, and the tone keeps its level to within 0.1 dB.
Key features
- Hum found automatically from the averaged spectrum, or set by hand to 50 Hz, 60 Hz or any fundamental from 20 to 400 Hz
- Up to 16 notches with an adjustable width, plus an optional 2nd-order high-pass for rumble
- A before and after spectrum chart, an A/B player and WAV or MP3 export
How hum is detected and how the notches are built
Detection averages the power spectrum of the whole file from Hann-windowed FFTs, up to 64 windows spread across it. The FFT is the largest power of two up to 65,536 points that fits, so a 44.1 kHz recording longer than about 1.5 s gets bins 0.67 Hz wide. For the 50 Hz family and the 60 Hz family it tries fundamentals within 0.5 Hz either side in 0.05 Hz steps, scores each by how far the peaks of its first ten harmonics stand above their surroundings (the median level from 4 to 14 Hz either side), and keeps the family whose three strongest harmonics average higher. It then refines the fundamental from the strongest peaks with a parabola through the three bins around each. A hum counts as found when those three average at least 6 dB and at least two of the harmonics reach 6 dB on their own; a harmonic counts only if its peak sits within about 0.2 Hz (a little more for higher harmonics) of the exact multiple and is not on the edge of its search window, and the refined fundamental stays within 0.5 Hz of the grid point. A bass note at 98 Hz has partials that pass near, but not on, a 50 Hz series, so it is not read as hum and does not pull the fundamental off 50.0 Hz.
The notch for harmonic k is a standard second-order notch at k times the fundamental, with a -3 dB width of the width you set (3 Hz by default) times 1 plus 0.15 for each harmonic above the first: 3 Hz at 50 Hz, 3.45 Hz at 100 Hz, 4.8 Hz at 250 Hz. Notches above 0.45 of the sample rate are skipped. The optional high-pass is a second-order Butterworth; set to 80 Hz it removes 12.3 dB at 40 Hz, is 3 dB down at 80 Hz and 0.1 dB down at 200 Hz.
How it works
Each notch has its zeros on the unit circle at its frequency, so the response there is zero in theory and deep in practice. With the hum at 50.06 Hz the cascade removes 43.5 dB at 50.06 Hz and 38.7 dB at 100.14 Hz, 0.02 Hz from its notch, but only 0.42 dB at 55 Hz, 1.06 dB at 53 Hz and 0.04 dB at 440 Hz.
Filtering runs through every channel in 64-bit arithmetic, one notch after another, in slices of about a million samples so the page stays responsive, and Cancel stops between slices. The after spectrum is measured on the result with the same FFT, so the chart and the figures describe the audio that will be exported.
Common use cases
- Rescuing an interview recorded with a laptop on its charger: Auto finds a 60 Hz family with spikes at 60, 120 and 180 Hz and removes them with eight notches, leaving the voice alone.
- Cleaning a guitar take with a 100 Hz buzz and no line at 50 Hz: choose Custom, enter 100, remove 6 harmonics at a width of 2 Hz.
How to use this tool
- Drop the recording; its spectrum is measured as soon as it has decoded.
- Read the detection line: a found hum names its fundamental and how far its strongest harmonics stand above the noise.
- Leave Auto on, or choose 50 Hz, 60 Hz or Custom, then set the number of harmonics and the notch width.
- Press Remove the hum, then switch between Before and After while the file plays.
- Export WAV or MP3.
Example
A stand-in for a voice recorded next to mains wiring: 20 seconds of noise, a 440 Hz tone for the voice and a 50.07 Hz hum with six harmonics; Auto, 8 harmonics, width 3 Hz, no high-pass
Auto detection, 8 harmonics, notch width 3 HzWhat the page reports
Hum found: 50.06 Hz (50 Hz family), strongest harmonics average 12.5 dB above their surroundings
Harmonics 1, 2, 3 before: +7.6, +17.9, +11.7 dB
Harmonics 1, 2, 3 after: -4.5, -3.5, -5.0 dB
440 Hz tone: 54.5 dB before, 54.4 dB afterTips for best results
- Start at 3 Hz and widen only if the chart still shows a ragged spike; every extra hertz of width also takes a little of whatever music or voice sits at that frequency.
- A weak fundamental with strong 2nd and 3rd harmonics is typical of laptop microphones, which barely pick up 50 Hz, so look at 100 and 150 Hz on the chart before deciding a file has no hum.
- Use the high-pass for rumble below the hum, not for the hum itself: at 80 Hz it takes 12.3 dB off 40 Hz but only 3 dB off 80 Hz, so it cannot replace a notch at 50 or 60 Hz.
Common pitfalls
A notch removes everything at its frequency, hum or not, so a bass note near 100 Hz or a voice with energy at 120 Hz loses a sliver of itself. Width is the knob that limits that.
Hum that wanders, for example from a generator, is wider than a 3 Hz notch and leaves a residue; widen the notches or accept it.
Below about 1.5 s of audio the FFT is smaller than 65,536 points, the bins are wider than 0.67 Hz and the fundamental is found less exactly.
Common errors and how to fix them
- No clear hum: the strongest harmonic family averages only 2.7 dB above its surroundings
- If you can hear a drone, pick 50 Hz, 60 Hz or Custom by hand. If you cannot, there is nothing narrow for a notch to remove.
- The hum frequency must be between 20 and 400 Hz
- Enter the fundamental in hertz. For a 120 Hz buzz from rectified 60 Hz mains, enter 120, or enter 60 to remove all of its multiples.
- The notch width must be between 0.5 and 20 Hz
- Type a width in hertz at the fundamental; the higher harmonics widen from it automatically.
Best practices
- Compare Before and After on the quietest passage of the recording, where the hum was most audible, rather than on speech.
- Look at the 'after' chart before exporting: any spike left standing at a dashed line means the notch is too narrow for that harmonic.
- Export WAV when more edits follow in another program, and MP3 only as the last step, so the lossy encode happens once.
50 Hz or 60 Hz
Mains runs at 50 Hz in most of Europe and 60 Hz in North America, and the hum it causes sits at that frequency and at whole multiples of it. Rectifiers and light dimmers add buzz at twice the mains frequency, 100 or 120 Hz, often with no visible line at the mains frequency itself. Auto compares the two families and reports the stronger; when both are weak it says so instead of guessing.
Reading the chart
The red line is the recording's averaged spectrum and the green line is the result. Dashed amber lines mark the notch frequencies. A hum shows as a thin spike on a dashed line; after filtering the green line should have a small dip there instead. Everything between the lines is left as it was, which is why a voice or a tone elsewhere in the spectrum does not move.
Frequently asked questions
Will this remove a buzz or hiss as well?
No. Hum is a few pure tones, which notches can reach. Buzz and hiss are spread across the spectrum, and Audio Noise Reducer on this site is the tool for those.
Why does it say 50.06 Hz and not 50 Hz?
Mains frequency drifts a little, and harmonic k drifts k times as much. A notch at exactly 50 Hz would sit 0.06 Hz off the fundamental and 0.6 Hz off the tenth harmonic, so the page refines the fundamental from the peaks.
Is the stereo image kept?
Yes. Each channel runs through the same notches separately, so the balance between left and right does not change.