CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

problem with code output

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
metacase
Guest







problem with code output
PostPosted: Tue Jan 27, 2009 2:10 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Jan 27, 2009 8:41 pm     Reply with quote

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








PostPosted: Wed Jan 28, 2009 7:41 am     Reply with quote

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







PostPosted: Wed Jan 28, 2009 9:32 am     Reply with quote

How is buffer declared?.
Was the code written in CCS C originally, or in another C?.

Best Wishes
Guest








PostPosted: Wed Jan 28, 2009 10:51 am     Reply with quote

I have the answer:
it's a cross correlation between one signal from mic_1 and the other signal from mic_2.
thanks.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group