# determine background noise level via cross correlation

The setup: Sound is being played by the speaker on the iphone. At the same moment i record sound via the microphone. Obviously the speaker sound will be recorded in addition to all the external noise.

My goal: To determine the level of all external sound which is recorded in addition to the sound from the speakers.

(no implementation yet) So far my approach is to cross correlate the input stream with the output stream to get the delay between both of them and an integer representing the level of similarity at this point, which will be used to estimate external noise. (if the int drops below a given value the noise is too loud)

Has anyone experience with stuff like that, if this approach will be accurate enough to make a guess if the external noise reaches a certain level of disturbance? Or will i have t do further analysation in the frequency domain via fft for example.

I'm completely new to this kind of problem so be kind with me, if I'm totally wrong ;)

• Since FFT is linear and shift or delay does not change the amplitude spectra, you can simply compute the difference of the input and output amplitude spectra, which will be the spectrum of the external noise. From there, you can compute the external noise level. Oct 23, 2012 at 4:00
• in the first place i tried to avoid fft since its less performant then a single cross correlation isn't it? can i avoid the dimension change via fft and analysing the spectrum, or would the results be less useful with one single cross correlation? And don't i need the delay of the two signals to correctly adjust the window for the fft since the computation takes place during the playback? hope i get everything right with the functions and their parameters/functionality ;) thanks so far!
– Maximilian Körner
Oct 23, 2012 at 8:04
• Maybe try an adaptive filter like a weiner filter or kallman filter. Oct 23, 2012 at 14:50