Autocorrelation - How to implement step by step

  • Thread starter atferrari
  • Start date
  • #1
8
0
Hola, my first time in this forum.

Two microphones at diferent distances from an audio source are receiving the same steady signal (frequency/amplitude unchanged).

A microprocessor takes succesive samples of both channels in batches of N samples. Time between samples is ts microseconds.

Once a batch is ready I want the micro to calculate the time difference (lag) between the incoming signals.

I know I have to use autocorrelation here (cross correlation of itself, right?).

In spite of reading a lot I could not conclude what is the formula to be solved thus how to program the micro to calculate the lag between both channels.

Can anyone tell:

The actual formula to be implemented?.

What are the succesive steps required to process the data set just acquired?

Normalization, is it needed? If so, how do you actually do it and when?

I am not into high level maths so bear with me. Math notation is sometimes quite hard for me to follow.

Gracias for any help.

Agustín Tomás
 

Answers and Replies

  • #2
When you say the lag between the channels, do you mean that you want to find how much longer it takes microphone 2 to get the sound microphone 1 got?

If this is the case, if you subtract the distance from microphone 2 to the sound source from the distance of microphone 1 from the sound source,

and then divide that difference by the speed of sound, you should get the lag between what time one microphone gets the sound and the other one get it.

This assumes that the computer processor? of both microphones doesn't lag - I don't know if you mean computer lag or the difference between when sound reaches the microphone.

This doesn't answer your question if you want the computer to calculate it, by only using the sound batches N. If this is the case I'm still trying to use a special diagram to solve it.


Hope this helps.
 
  • #3
rbj
2,226
9
i might suggest to the OP to post this at the USENET newsgroup comp.dsp.
 
  • #4
8
0
To RandomMystery and rbj

Thanks for replying.

You got my idea right, "lag" is the difference between when sound reaches the microphone.

If the audio source moves wrt microphones, in any sense it does, distances will change even if distance between microphones keeps.

I want the microprocessor to calculate it using autocorrelation.
 
  • #5
As soon as the first microphone picks up some noise, it should send a signal to the second microphone to record time. It then stops recording that time, when the same sound reaches it. The time recorded is the lag.

Now, do you also want an equation to also factor in the magnitude of the sound? The method above should work, but the equipment that is farther away from the sound source, will register it as having less batches of N. I'm assuming that when one microphone gets N batches, the other one won't recognize the sounds as N batches, but as N - x batches, (since it's farther away)
If that's the case, we need to find some ratio or relation ship between the batches of one microphone and the other. Which I'm still trying to do with the same diagram.
 
  • #6
Okay, this might work:


(Distance from the farther microphone to the sound source - the Distance from the nearer microphone to the sound source)
(Batch N from the nearer microphone - Batch N from the farther microphone)



Test and see if this ratio is true for every distance (or just enough to prove it's accuracy). If it is true, then all you have to do is:


(Batch N from the nearer microphone - Batch N from the farther microphone)(the same ratio written above)
(the speed of sound)

*This looks kind of messy, the underline indicates divide by whats under it.
You only have to find that ratio once, if my assumptions are correct. Assuming that your not moving the microphones, but only the sound source.

Edit: To calculate the distance, have a computer start recording time when sound is released, then have the microphone send a signal to stop the recording time when the signal reaches the microphone. Divide the duration of the recording by the speed of sound to get the distance. Make sure you have the right units.
 
Last edited:
  • #7
8
0
Hola RM,

Quoting myself:

Can anyone tell:

The actual formula to be implemented?.

What are the succesive steps required to process the data set just acquired?

Normalization, is it needed? If so, how do you actually do it and when?


As the the title says, with Autocorrelation. I want to solve it that way.

Thanks for your time, anyway.
 
  • #8
8
0
Hi RM,
I have been told to use cross correlation since the signal en each channel is to be considered a different one. No outocorrelation then.

Sorry for wasting your time. Thanks.
 

Related Threads on Autocorrelation - How to implement step by step

  • Last Post
Replies
1
Views
4K
Replies
2
Views
7K
Replies
10
Views
862
  • Last Post
Replies
1
Views
1K
  • Last Post
Replies
7
Views
3K
  • Last Post
Replies
5
Views
3K
  • Last Post
Replies
6
Views
2K
  • Last Post
Replies
2
Views
314
Replies
2
Views
1K
  • Last Post
Replies
1
Views
2K
Top