This is a surprisingly common question, and the poser of the question often suggests gates or plug-ins as a potential solution.
But hum should be eliminated before it gets onto your recording. Fixing the problem later should be an emergency measure, not everyday routine.
There is one item of equipment that is allowed to hum - a vintage guitar amplifier. You have clearly chosen the amp because you like its sound, and the hum is something that you will have to put up with. It stems from the high input impedance of the amp, coupled with low expectations hum-wise on the part of the designer all those years ago.
Electric guitars in addition often suffer from buzz, which is a different thing to hum and is not considered here.
If you have a hum in your studio, then the first thing to do is to get the mains earth checked out by a qualified electrician. If you don't do this, then you probably won't be able to cure the hum, and you could indeed be dead before you achieve a hum-free recording. So get that done and you have made a good start.
Once you have a good mains earth in place, the next step is to reduce your system to its absolute basics. That would be a microphone, mixing console and headphones, or a computer-based DAW (no mic or preamp) and headphones.
Can you hear a hum? If you can, and you did get your earth checked, then the equipment is faulty. Get it repaired or scrap it.
But the likelihood is that you won't get any hum with such a simple system. Now rebuild your system item by item until the hum reappears. When it does, you will know the culprit.
The most likely scenario is that the equipment that caused the hum to reappear has a connection to mains earth and you have created an earth loop by having two connections to mains earth.
This loop needs to be broken. The best way would be to use a transformer in the signal path, but an alternative that usually works is to cut the screen connection at one end of the audio cable connecting the two items. If there is more than one audio cable, then all the screens need to be cut at one end, inside the connector.
Getting rid of hum can be a real pain, but that is nothing like the pain of living with it every day. The ultimate solution is to use only equipment that is balanced. The signal is isolated from earth so the hum can't get in to spoil your day.
Save the gates and plug-ins for recordings that have already been made and suffer from hum. You should never allow hum a chance to get onto your recording in the first place.Come on the FREE COURSE TOUR
Great home recording starts with a great home recording studio. It doesn't need to be expensive if you know how to select the right equipment for your needs.Download Now
Get the Audio Masterclass Newsletter, subscriber-only info and special offers too.