Removing hum from a recording

@steve Thanks a million for getting me started with hum remover. Once you know how to use it, it is a fantastic tool. I have managed to get quite close to removing the hum in this sample file (there are six more on the album).

With the hum, the spectrogram of a low level passage (where the hum is clearly audible) looks like this:

After some tweaking by ear with hum remover (4 odd, 4 even, threshold 10%) it looks like this:

I noticed that there is not much in the spectrogram at 50Hz, so it looks to me that the notch at 50 Hz does not do much except cut out signal. Do you have any suggestions how I could improve the result?

In 2017 I had already taken a shot at removing the noise (on Gaspard, another track of this album). Digging through my archives, I found the spectrogram from back then. It is very similar to the one of the Debussy above. I have no idea though how had the spectorgram settings to get the dark lines. I find they show the spectral lines better than the light on dark.
I had used notch filters starting with Q=20 @100Hz to Q=40 at 1000Hz.

If there only a few mains-hum harmonics you can remove them individually with spectral editing tools, (rather than the hum-remover plugin)
100Hz-200Hz only
de-hum begins ~8sec.flac

Thanks @Trebor
I have selected the frequency, but my menu only shows spectral delete, not edit:


EDIT: found the spectral multi tool. I had to remove the grouping in the effects menu … or even better, look in the correct place (under Paul …)

Try this:
1- Create a new text file.
2- Paste the following code.
3- Save it as “De-Hum.ny”.
4- Copy the file into Plug-Ins folder.
5- use it from effects menu.

;nyquist plug-in
;version 3
;type process
;categories ""
;name "Hum Remover"
;action "Filtering...."
;info "By Steve Daulton.\nReleased under GPL v2 Dec. 2009\n\nFor Audacity 1.3.8 or later.\n\n"

;control basef "Select Region" choice "Europe (50Hz),USA (60Hz)" 0
;control odd "Number of odd Harmonics" int "" 20 0 200
;control even "Number of even Harmonics" int "" 1 0 20
;control thresh "Hum Threshold Level(0 to 100%)" real "" 10 0 100

(setq basef 
   (case basef 
      (0 50)
      (1 60)))

(defun sanitise (var min max)
   (if (> var max) max
      (if (< var min) min var)))

(setq floor 0.00002)
(setq odd (sanitise odd 0 1000))
(setq even (sanitise even 0 1000))
(setq thresh (/ (sanitise thresh 0 100) 100.0))
(setq attack 0.25)
(setq look attack)
(if (or (> (* basef (1+ (* odd 2.0)))(/ *sound-srate* 2.0))(> (* basef (+ 2 (* even 2.0)))(/ *sound-srate* 2.0)))
   (format nil "Error!~%~%Sample rate of ~aHz is too low for ~a harmonics.~%~%Set fewer harmonics." *sound-srate* (max odd even))
      (defun dehum (s-in itr itr2)
         (dotimes (var itr s-in)
            (setq s-in 
               (notch2 s-in (* basef (1+ (* var 2.0))) (+ (* 4 var) 2))))
         (dotimes (var itr2 s-in)
            (setq s-in
               (notch2 s-in (* basef (+ 2 (* var 2.0))) (+ (* 4 var) 4)))))
; left/right tracks linked for gate-follow to prevent left/right wobble         
      (defun gate-follow (s-in)
         (setq s-in (hp s-in 20)) ; hp filter to remove DC off-set
         (if (arrayp s-in) ; if stereo track
            (s-max (s-abs(aref s-in 0))(s-abs(aref s-in 1)))
            (s-abs s-in)))
   (setq gatefollow (gate-follow s)) ; audio for gate to follow
; gate envelope tracks gate-follow 
   (setq g-env 
      (clip (gate gatefollow look attack attack  floor thresh) 1.0))

      (defun noisegate (s-in env)
         (mult s-in env))

      (defun residual (s-in env)
         (mult s-in (sum 1.0 (mult -1 env))))
         (multichan-expand #' noisegate s g-env)
         (dehum (multichan-expand #' residual s g-env) odd even)

Thanks, @Meem
Audacity had already saved the script when I installed the plugin

This topic was automatically closed after 30 days. New replies are no longer allowed.