View previous topic :: View next topic |
Author |
Message |
metacase Guest
|
problem with code output |
Posted: Tue Jan 27, 2009 2:10 pm |
|
|
hi!
i'm making a 4 microphone array to recognize a source of sound, like voice.
The algorithm which returns the angle of the ubication of the source need the next function.
Code: |
unsigned long dot_product(unsigned int mic1,unsigned int mic2, int desfase)
{
unsigned long p;
int i,j;
p = 0;
for(i=0;i<BUFFER_SIZE;i++){
j = (i + desfase + BUFFER_SIZE)%BUFFER_SIZE;
p = p + (unsigned long)(((buffer[4*i + mic1]>>2)*(buffer[4*j + mic2]>>2))>>5);
}
return p;
}
|
note: BUFFER_SIZE=64
the problem is that i don't understand the meaning of the last line.
thanks! |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Jan 27, 2009 8:41 pm |
|
|
Do you mean the last line in the calculations ?
Did you get this code from some webpage ? If so, post a link to the
webpage. |
|
|
Guest
|
|
Posted: Wed Jan 28, 2009 7:41 am |
|
|
PCM programmer wrote: | Do you mean the last line in the calculations ?
Did you get this code from some webpage ? If so, post a link to the
webpage. |
yeah, the last line, i got the code from a student who did this project long time ago, at that time the project worked, but now is not working, so i have to fix it. |
|
|
Ttelmah Guest
|
|
Posted: Wed Jan 28, 2009 9:32 am |
|
|
How is buffer declared?.
Was the code written in CCS C originally, or in another C?.
Best Wishes |
|
|
Guest
|
|
Posted: Wed Jan 28, 2009 10:51 am |
|
|
I have the answer:
it's a cross correlation between one signal from mic_1 and the other signal from mic_2.
thanks. |
|
|
|