Hum removal

Share your Audacity/Nyquist plug-ins here, or test drive the latest plug-ins submitted by Audacity users.

After testing a plug-in from this forum, please post feedback for the plug-in author.
steve
Site Admin
Posts: 80677
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Hum removal

Post by steve » Thu Feb 13, 2014 1:40 am

"Mains Hum" is a common problem. It is a hum with a base frequency of 50 Hz (Europe) or 60 Hz (US). Usually there are a lot of harmonics of the base frequency.

This can usually be effectively filtered out with notch filters, but in some cases may require dozens of notches to handle the audible harmonics.

We already have two "Hum Removal" filters on this forum. Either of them can produce good results, but I don't think either of them are particularly user friendly and generally require a lot of trial and error to find settings that remove enough hum without affecting the remaining sound too badly.

It would be much easier if we had a real time effect, but that is likely to be a long way off, so I'm wondering what we can do to improve the tools so that they are effective and easier to use.

Any thoughts anyone?

kozikowski
Forum Staff
Posts: 68902
Joined: Thu Aug 02, 2007 5:57 pm
Operating System: macOS 10.13 High Sierra

Re: Hum removal

Post by kozikowski » Thu Feb 13, 2014 2:21 am

Most times the performance hums because it doesn't know the words.

Ba Dump. Tish!

Is this a good place to background connect Analyze > Spectrum to the notch generator?

Drag-select a portion of the show with hum only (if you have a large enough selection, it doesn't even matter if there is a little performance in there, too).

"Cool. Let's see. We'll need a notch here. And one over there...."

Although I guess that's what Noise Reduction, sorry, Removal does anyway, isn't it?

Is there such a thing as "Standard Hum?" I can pick out open-shield 60Hz buzz in a line-up from across the street. It's very distinctive -- not at all start-from-zero random.

I think Sound Soap had Standard Hum Removal.
Yeah, here it is:

Remove Hum
[X] .. 60
[_] .. 50
[_] .. Off

Koz

kozikowski
Forum Staff
Posts: 68902
Joined: Thu Aug 02, 2007 5:57 pm
Operating System: macOS 10.13 High Sierra

Re: Hum removal

Post by kozikowski » Thu Feb 13, 2014 2:26 am

Can I assume you can't test for effectiveness? Do a recursive filter generation?
Take Out 180.
Test for 180.
Take more out.
Test...

If: No Change.
Then: take Out 360.

Koz

steve
Site Admin
Posts: 80677
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Hum removal

Post by steve » Thu Feb 13, 2014 4:18 am

kozikowski wrote:I think Sound Soap had Standard Hum Removal.
Yeah, here it is:

Remove Hum
[X] .. 60
[_] .. 50
[_] .. Off
Taking out 50 / 60 Hz is easy. The problem is taking out the harmonics.
In some cases the "fundamental" (50 / 60) can be quite weak, but there still be a pronounced audible hum due to the harmonics.

kozikowski wrote:Is there such a thing as "Standard Hum?" I can pick out open-shield 60Hz buzz in a line-up from across the street. It's very distinctive -- not at all start-from-zero random.
Within limits, the hum is predictable.
If the hum is exactly 60, 120, 180, 240 ... Hz, then extremely narrow notches can be used, which will leave the "music" virtually untouched, unless of course the music happens to hit one of those frequencies.
If the music does hit one of those frequencies, then not only does it get taken out, but it takes a few moments for the filter to "catch up", and in those few moments it rings. Thus a broadband transient, such as a hand clap, does not just go "snap" it goes "ping...."

The amount of ringing can be reduced by using a wider notch, but that will take out a broader band of frequencies.

In practice the hum (after it has been recorded) will probably not be the exact frequencies expected. For a very narrow notch (say q=50) the attenuation at the centre frequency will be more than 100 dB, but as little as 0.1% off the centre the attenuation drops to 20dB. Unfortunately it is difficult to measure frequencies to that degree of accuracy, and if (as occurred recently) the original recording was made on tape, then the frequency will probably not be constant. At some point we have to give up and say it can't be fixed, but within limits we can make compromises. The difficulty is in how to automate those compromises.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

steve
Site Admin
Posts: 80677
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Hum removal

Post by steve » Thu Feb 13, 2014 5:24 am

kozikowski wrote: Drag-select a portion of the show with hum only (if you have a large enough selection, it doesn't even matter if there is a little performance in there, too).
"Cool. Let's see. We'll need a notch here. And one over there...."
kozikowski wrote:Can I assume you can't test for effectiveness? Do a recursive filter generation?
Yes and Yes.

Nyquist doesn't have access to Audacity's spectrum analyzer, but it could recursively test a noise sample and work it's way up the harmonic progression until it makes no difference. That would be the "hum profile".
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

kozikowski
Forum Staff
Posts: 68902
Joined: Thu Aug 02, 2007 5:57 pm
Operating System: macOS 10.13 High Sierra

Re: Hum removal

Post by kozikowski » Thu Feb 13, 2014 8:43 am

Taking out 50 / 60 Hz is easy. The problem is taking out the harmonics.
I don't think it's just taking out the fundamental. Sound Soap's reputation was that it could make things sound good. You can't hear either 60 or 50. It could also derive a noise profile without the profile step. Whatever single sound is there the longest is probably the noise.
Nyquist doesn't have access to Audacity's spectrum analyzer, but it could recursively test a noise sample and work it's way up the harmonic progression until it makes no difference. That would be the "hum profile".
That's the automated version right there. The fancy-pants® version sloppy tests for 50/60, then which 50 or 60 and then goes up.

I wouldn't even have to be fast.

[Now sniffing your hum. This may take a while]

I still don't think it's all that random. I can listen that that buzz and tell you which Belden microphone cable and where the break is.

Koz

kozikowski
Forum Staff
Posts: 68902
Joined: Thu Aug 02, 2007 5:57 pm
Operating System: macOS 10.13 High Sierra

Re: Hum removal

Post by kozikowski » Thu Feb 13, 2014 10:34 pm

If the music does hit one of those frequencies, then not only does it get taken out, but it takes a few moments for the filter to "catch up", and in those few moments it rings. Thus a broadband transient, such as a hand clap, does not just go "snap" it goes "ping...."
Air-juggling notch filter characteristics is not the only way to deal with this. Generate an equal but opposite phase tone.

In the US, the NTSC television color signal was clearly visible in the image and needed to be removed.

http://www.kozco.com/tech/ntsc/ntsc.html

In the bad old days, they used straight notch filters which worked, but they removed everything around the color (sorry, colour) and made the image muddy and soft -- or left artifacts. Then somebody generated a way to phase cancel the color signal through delays and some TV Art Tricks. No bandpass problems, so all the crispness and fine detail came roaring back and it almost looked as good as PAL.

Koz

vpd
Posts: 103
Joined: Tue Feb 26, 2013 4:28 pm
Operating System: Linux Debian

Re: Hum removal

Post by vpd » Wed Feb 19, 2014 2:13 pm

I use an unversal method, it works like magic, but I'm not sure if it's not possible to automate it with Nyquist...

Here is the algorythm:
1) make 2 duplicates of the sound file.
2) invert the data of 1st copy.
3) cut the low frequencies (main hum frequency) with notch filter or parametric EQ filter of the 2nd copy.
4) mix & render the both copies, now we have the hum sound + some "useful" low frequencies (especially if it's about drums) with inverted data.
5) compress the "useful" sound to the maximum level of hum frequency (it appears clearly at some points), now we have the noise profile with inverted data.
6) mix & render the noise profile with original sound file.

steve
Site Admin
Posts: 80677
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Hum removal

Post by steve » Wed Feb 19, 2014 9:04 pm

vpd wrote:Here is the algorythm:
1) make 2 duplicates of the sound file.
2) invert the data of 1st copy.
3) cut the low frequencies (main hum frequency) with notch filter or parametric EQ filter of the 2nd copy.
4) mix & render the both copies, now we have the hum sound + some "useful" low frequencies (especially if it's about drums) with inverted data.
5) compress the "useful" sound to the maximum level of hum frequency (it appears clearly at some points), now we have the noise profile with inverted data.
6) mix & render the noise profile with original sound file.
I've tried to reproduce that, but I must be doing something wrong because I always get worse results than just notch filtering.

These are the tracks I have at each step:
I have:
Step 1. The original track (unprocessed), and 2 copies of the original (unprocessed)
Step 2. An inverted copy, the original and an unprocessed copy of the original
Step 3. The original track, and inverted copy and a notch filtered copy.
Step 4. The original track and a mix made from the 2 copies.
Step 5. The original and the processed copy (compressed).
Step 6. A mix of the two tracks from step 5.
Is that correct?

3) cut the low frequencies (main hum frequency) with notch filter or parametric EQ filter of the 2nd copy.
Should I do that in Audacity with the Notch filter? What settings should I use?

5) compress the "useful" sound to the maximum level of hum frequency (it appears clearly at some points), now we have the noise profile with inverted data.
Exactly how do I do the "compression"? What effect and what settings?
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

kozikowski
Forum Staff
Posts: 68902
Joined: Thu Aug 02, 2007 5:57 pm
Operating System: macOS 10.13 High Sierra

Re: Hum removal

Post by kozikowski » Thu Feb 20, 2014 8:18 am

Again to go briefly down the cancellation pathway, use a peak filter to isolate one of the evil frequencies, say 120Hz. The metaphor is do it to a copy of the show. Get the isolation so sharp that the sine wave is all that is left. Do it over time so chances of a musical performance at 120 Hz is very low.

Reverse the phase and add it to the show. This is the step where it may be necessary to generate an appropriate 120 Hz sine wave rather than depending on the filtered one from the copy of the show.

Only the precise waveshape of the sine will vanish from the show leaving all the rest of the show including musical tones around 120 Hz perfectly intact. There are no filter skirts, bandpass ripples, or other instabilities affecting the show because the process is exactly the opposite of how the hum got into the show in the beginning.

Koz

Post Reply