2
$\begingroup$

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 ;)

$\endgroup$

migrated from stackoverflow.com Oct 23 '12 at 12:53

This question came from our site for professional and enthusiast programmers.

  • $\begingroup$ 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. $\endgroup$ – chaohuang Oct 23 '12 at 4:00
  • $\begingroup$ 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! $\endgroup$ – Maximilian Körner Oct 23 '12 at 8:04
  • $\begingroup$ Maybe try an adaptive filter like a weiner filter or kallman filter. $\endgroup$ – Bjorn Roche Oct 23 '12 at 14:50
2
$\begingroup$

If you want to get an estimate of the noise, do the cross-correlation, and then multiply your transmitted sound by your cross-correlation peak and then subtract it from your received sounds. Make sure, of course, that you use the cross-correlation to line up the transmitted sound with when it was received.

What remains after you subtract is the noise with some amount of (hopefully small) error.

$\endgroup$
  • $\begingroup$ in my understanding the peak of the cross correlation function is the level of similarity of the correlated functions and the position of the peak is the offset between them. wouldnt the peak value alone be sufficient to estimate weather there is a certain amount of noise or not? and another question to your (most likely more accurate) approach, what is the effect of the multiplication by the peak? align the level of both signals to be equal? thanks! $\endgroup$ – Maximilian Körner Oct 28 '12 at 22:33
  • $\begingroup$ Yes, your first sentence is correct. Your received signal is the transmitted signal with some time/amplitude/phase offset, plus some noise. When you cross-correlate, the signal portion "responds" strongly but the noise does not (because it has no relationship with the transmitted signal), so the cross correlation tells you very little about the noise. The idea is to remove the signal as best you can, which leaves only the noise. You can then measure the noise. $\endgroup$ – Jim Clay Oct 29 '12 at 0:19
  • $\begingroup$ thanks that helped. in the first place i thought the more noise is in there the lower the peak will be and that this would be accurate enough to estimate noise. but i think by extracting the noise your way im on the safe side. what does the multiplication of the peak do to the transmitted data? amplitude alignment? $\endgroup$ – Maximilian Körner Oct 29 '12 at 0:24
  • $\begingroup$ Yes, amplitude alignment. $\endgroup$ – Jim Clay Oct 29 '12 at 0:57
  • $\begingroup$ It would be easier to help if we could see the two signals. I suggest creating a new question and including the images of the output signal, recorded signal, and cross-correlation. $\endgroup$ – Jim Clay Nov 9 '12 at 10:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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