Go Down

Topic: Sound Localization (Read 5 times) previous topic - next topic

johnfraiser

So i am about to incredibly over simplify this process by the way i describe it however tell me if I am on the right lines.

If i take the time difference before you apply the negative feedback loop, or are they one in the same in terms of calculations?
Then use the function you described in your last post, arcsine function I can determine the angle in which the sound has come from?

Magician

There are 2 lines :
Code: [Select]
           if (count)    summa /= count;
           srvoPosn[y] -= summa; 

If you are not going to use servo, than you  need to change type of srvoPosn[] to "float", and remove code  "if / else" statement that follows. Than
Code: [Select]
  srvoPosn[y] = asin ( koeff * summa / 2048.0) * 180.0 / PI;
I'm not ready to give a coefficient "koeff" ,  sure it's would be proportional to distance between mic's - base, you have to find out from practice.   asin defined in -1 : +1.
http://www.cplusplus.com/reference/cmath/asin/

johnfraiser

So as well as the code for determine the position of the servos that you mentioned should i also remove this

Code: [Select]

for ( uint8_t i = 2; i < MIRROR; i++)  // LIMITS: 150 HZ
        {                                      // Electrical grid interference, Motor Vibration.
          vremn = 0;                                       
          if ((x_r[0][i] != -1) && (x_r[1][i] != -1))
          {
            vremn = x_r[0][i] - x_r[1][i];           
            if (vremn >  1024) vremn -= 2048;
            if (vremn < -1024) vremn += 2048;
           
            vremn = (32 * vremn) / i;                                   
            vremn -= 256;                      // MIC Time Offset Correction (1 ADC, 25 usec delay).

          if (lokaVect[directin][i] < vremn) lokaVect[directin][i] += srvoAccl[directin];
          if (lokaVect[directin][i] > vremn) lokaVect[directin][i] -= srvoAccl[directin];
          }
        }


Or just a section of this, as it is filtering the motor sound right?

Thank you
John

Magician

No, chunk of code is filtering multipath propagation / reverberation

johnfraiser

This is the code i am currently employing however i am fairly sure my coefficient is completely wrong. I understand it should have a relation to the distance of the microphones but not sure how to calculate or determine what this should be. Do I need to workout what the average time it would take for the sound to travel the distance between them and use that as the coefficient?

I have tried a few completely random values for this but as im sure you can guess had no positive results.

Code: [Select]

float coefficient = 400;
float soundAngleY = srvoPosn[y];
soundAngleY = asin (coefficient * summa / 2048.0) * 180.0 / PI;

Go Up