# How to get the background noise of microphone?

I am working on the automatic volume control for television which should take care of background noise. For this, I need to first find out the background noise. I have read in research papers that we need to subtract original audio signal which can be obtained from audio amplifier present in tv from the recorded signal by the microphone. Here microphone will be recording both original audio signal plus noise. But they have also mentioned about phase and amplitude correlation. I do not understand how to do that.

For a given TV, if you send a single short pulse (with an arbitrary amplitude of '1') out the speaker. The microphone will receive a slightly distorted pulse a short time later. (Typically you would send a pulse with enough volume that the microphone gets a clear reception of it, then reduce the microphone signal proportionally to simulate an original speaker signal with amplitude of '1'.) That distorted and delayed microphone signal is called the "impulse response" of that particular TV system. That impulse response (including the delay from the instant the signal was sent to the speaker) will need to be stored in your software for that TV.

Then to remove the distorted speaker signal from your microphone signal, you need to take the original electronic speaker signal and multiply it by that impulse response, and then subtract the result from your microphone signal. You do all this in the frequency domain because its far simpler and more efficient than doing it in the time domain. You don't even have to turn the final microphone signal back into time domain since you only wanted the ambient volume, anyway.

Look up "convolve impulse response".

EDIT: To clarify (per your comment): The impulse response of the speaker-to-microphone path is a measure of the delay and distortion created by that path--and that's what you initially experimentally measure in the lab. But you don't know the impulse response of the noise-source-to-microphone path, so you can't correct for that distortion. All you can do is note the power spectrum of the noise (after subtracting the speaker contribution), and then adjust the speaker volume and maybe spectrum in order to help compensate for that noise. By the way, be sure to do the arithmetic (the multiply and the subtract) in the complex plane, because the FFT data is complex.

• Thanks for reply @Digiproc. I have one more doubt . For finding out the volume change I am comparing the energies of original signal and background noise. So is it fine to directly compare the energy of background noise obtained after subtraction because it was recorded by microphone means it was multiplied by the impulse response so should I divide it with the impulse response before comparing the energy – Shivani Kshatriya Feb 4 '19 at 7:04
• Hi Shivani, I responded to this comment as an edit in my answer. – Digiproc Feb 4 '19 at 8:32
• Thanks @ Digiproc. As you have mentioned in your previous answer that we need to convolve with the impulse response before subtracting the original audio signal. In some research papers I read that impulse response can be found using LMS algorithm. So I tried implementing LMS. But after subtracting the LMS output from recorded signal what I am getting is again recorded signal. I have attached two figures in my original question. I am not understanding how the subtraction of two signals can give the first signal back as the answer.The result obtained after subtraction is shown in figure2. – Shivani Kshatriya Feb 7 '19 at 8:37
• The microphone signal is the sum of the noise and the (distorted) speaker output. Specifically: m = n + is, where m=microphone signal, n=noise, i=speaker-to-microphone impulse response, and s is signal sent to speaker. So to get only the noise, you subtract the distorted speaker signal from the microphone signal: n = m - is. I'm not sure how one would use the LMS algorithm to find the speaker-to-microphone impulse response. I would simply measure it in the lab for the given television set. – Digiproc Feb 7 '19 at 10:39
• My problem is not LMS algorithm. Problem is how can the subtraction of LMS output from recorded signal shown in the figure gives recorded signal as the output(noise). – Shivani Kshatriya Feb 9 '19 at 17:09