I'm trying to use my RPi4 as a real-time audio processing device to detect when a certain acoustic frequency is present in an environment. The pi performs real-time fft on an audio stream from a USB microphone. Developing the code on the raspberry pi using a monitor, I was encouraged because it seemed to work well. But I noticed that when I take the pi off my desk and try and deploy it headless in the real world, I get a lot of background noise and frequencies, so much so that I cannot detect the frequency of interest among the noise. Basically, as soon as I disconnect the monitor's HDMI cable from the pi, many background frequencies instantly appear on my frequency graph: (I was able to see these graphs using VNC viewer while the pi was headless)

With the monitor connected: After monitor is disconnected:

As soon as I reattach the monitor to the pi, the frequencies die down to nothing. I notice that when the monitor is connected, the audio input channel changes also:

With monitor connected

After monitor is disconnected

In my fft code I account for this change by automatically adopting the new input channel for the USB audio, so I am certain that the background noise is not caused by accidentally switching to a new microphone with more background noise when I remove the HDMI connection. In other words, the same mic on a different input channel now has much more background noise. What is causing this, and how can I correct for it? Is it a problem with the input channel and can I force the pi to use the same input channel while running headless? Thanks.

  • What audio hardware are you using ?
    – Matt
    Nov 23, 2022 at 19:13

1 Answer 1


To answer my own question: this is a grounding issue and not an input channel issue. The HDMI was grounding the pi and removing the ground is causing what I think is a ground loop interference problem. grounding the pi at any metal point (for example the usb hub) will get rid of the interfering frequencies. Hope this helps someone!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.