4 Answers
4

As heard within amplifiers, the frequency can be 100/120Hz (2nd harmonic of 50 or 60Hz) because of the rectification process when converting AC to DC to power said amplifiers. There can also be a component that is the third harmonic of 50/60Hz as well and this is magnetically "coupled" from the AC transformer inside an amplifier.

There are all sorts of variations too. Due to the rectification process and the magnetics of the transformer the second or third harmonic may well have overtones because of the peaky nature of current flowing into the rectifier when charging reservoir capacitors.

So, it depends on what does the picking up and how close it is to the source. A guitar pickup (non humbucker of course!) may pick up a lot of 50H/60Hz from the current in wiring in the walls of your building.

Why not take a recording of it and use some software to analyse the frequency spectra then generate sinewaves to recreate the components found in the spectra. Or just loop the sound you recorded as your "sound".

Can you elaborate a bit more on the "analyse the frequency spectra" or point me to some article(s) which can give a n00b some more insight?
–
Maurycy ZarzyckiAug 29 '13 at 6:29

@MaurycyZarzycki there are various programs that are quite possibly free that can analyse and manipulate wav files. These programs usually come with fast fourier spectrum analysers that produce a nice clean picture showing the various spectra of the signal. I use wavelab by steinberg but the re are plenty of others.
–
Andy akaAug 29 '13 at 7:14

It's a 50 or 60hz sine wave (depending on power frequency). You aren't going to get more accurate than that. The harmonics are going to depend on the particular power generation and will vary based on uncontrolled variations in both the grid and how the hum is actually being introduced in to the signal.

The fastest way to solve this problem is simply sample a mains hum / ground loop and work with that. I would start by recording 5 minutes of ground hum. Then find a section of about a minute long that loops nicely (make sure that the start and end points are aligned to either both a rising or falling zero-crossing). Then progressively shorten the sample until it no longer sounds good. You should be able to do this easily in Audacity. You can even generate a 50Hz or 60Hz sine wave in Audacity and play around with adding various harmonics until you get something that you like.

The slower way would be to still start with the mains hum, but instead of shortening below a 1-minute loop, use a Fourier transformation to determine the first few Cosine waves that make up your signal. Then you just code up an oscillator that is made up of those Cosine waves and their coefficients. You probably need fewer than 10 coefficients, but again you will want to experiment for yourself and pick what you like.