I am sure everyone trying to record sound with a Raspberry Pi has experienced a lot of issues with noise pollution. Although there is any number threads on various forum adressing this I have yet to find any conclusive and comprehensive answers. I have made some basic tests and I thought I would pose the question here to find other ways to improve sound recording.
So far I have traced the main course of noise to the following:
- Magnetic / Radio interference (EMI / RFI). This is caused by cables acting like recieving antennas and pick up radio frequencies or magnetic induction from nearby electrical cables and radio sources (wifi, fans in computers, TVs & screens, even the PI's own wifi). This is typically low frequency buzzing (50-150 HZ), usually associated with powercables, and higher frequency clicking and ticking from other electric equipment like wifi or electrical motors. The best cure I have found so far is to shield the entire soundcard and microphone with tin foil and ground it to the USB ground (the USB contact shield). As seen in picture below it reduces the lower frequencies with about 10db, the most marked reduction is below 1500 hz. I have also found it reduces interference by wifi.
(please note that the scale is different on the two pictures, so it looks like the unshielded has less noise but in fact it is more )
The USB soundcard itself. Some cheaper USB soundcards seem to generate their own noise frequencies. I have commonly had a cheaper USB cards give me strange spikes in noise at given frequencies, see picture below. I have tried several different usb soundcards and some will produce this strange z-wave. It sounds like a high pitched whining that drowns other sounds. Go with a known brand of USB soundcard!
Ground-loops is generally not a problem unless your USB sound card or your microphone is powered seperately. If the power goes RPI-soundcard-Microphone, then so does the ground and a loop is unlikely. Please correct if wrong
The PSU and Pi itself. Once you have removed the outside sources of noise with shielding, what remains is probably coming from the PI itself. Poor power supplies seem to be the main cause here but I have yet to find something that is working. Even official PSUs seem to cause noise. Ferrite beads will help some but they usually capture high frequency noise. The highest peaks of noise is below 1000 Hz.
These tests were performed on a RPI3 A+ with a moderatly good soundcard (approx 12 euro) and a small microphone. I am sure I could improve things with better equipment but then I would probably use a better computer for recordings.
I will try to test other setups and post results here.
But please, any suggestions by yea wise and knowledgeable are very welcome!
Add: Here are two pictures of an unshielded USB card and when it is less than 50cm from a computer screen and a wifi router (again, note difference in scale). Both sounds like ticking noise.
I have tried to put 3 electret microphone capsules in parallell as described in this post: https://electronics.stackexchange.com/questions/324450/can-i-connect-multiple-electret-microphones-for-better-gain
It works! I still have the noise from the pi (dirty PSU) and the soundcard but the recorded sound is so much louder that the noise is no longer covering the wanted sound (as much). The hardest part was to get the shielding to be coherent and closed all the way from capsule to USB connector. My 3 x mic seem to pick up a little more EMI than before but it also has more openings in the shield, i.e. the brass net I used to over the actual mic-membranes
Next will be trying to clean up power to Pi and Usb-soundcard.