Pages: [1] 2   Go Down
Author Topic: Sound Localization  (Read 3790 times)
0 Members and 1 Guest are viewing this topic.
Montreal
Offline Offline
Edison Member
*
Karma: 23
Posts: 2486
Per aspera ad astra.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset



Arduino Leonardo, two servos,  LM317, 9 resistors, a few capacitors and prototyping board.
Just can't be less...
Logged

field road, jupiter creek
Offline Offline
Sr. Member
****
Karma: 3
Posts: 348
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

That is really cool!

circuit?

code?

Details please!!!
Logged

Montreal
Offline Offline
Edison Member
*
Karma: 23
Posts: 2486
Per aspera ad astra.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Oppps, fixed:
http://coolarduino.wordpress.com/2012/10/01/sound-localization/
Logged

field road, jupiter creek
Offline Offline
Sr. Member
****
Karma: 3
Posts: 348
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yep!
I found it after I posted!

Great blog man!
Logged

USA, FL
Offline Offline
God Member
*****
Karma: 14
Posts: 686
A life? Where can I download one of those?
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

"The video has been blocked in your country on copyright grounds."

How I love the US

Please do not quote this post as it is mine and no one else can use it without paying me 100 million dollars.
Logged

//LiNK

Montreal
Offline Offline
Edison Member
*
Karma: 23
Posts: 2486
Per aspera ad astra.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yeh, this is a problem of using nice sound track with a project. There is one more clip I posted earlier, which appears to be moderately restricted, only "matched third party content":

 I'll take another video outside, on big scale, whenever weather 'd change its mood. Its rainy in Montreal right now.
« Last Edit: October 06, 2012, 11:18:31 am by Magician » Logged

USA, FL
Offline Offline
God Member
*****
Karma: 14
Posts: 686
A life? Where can I download one of those?
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Nice setup.  And thanks for throwing up another vid!  Will be following your progress as I am looking for ways to localize sound with my project, but not quite at the stage for implementing it.
Logged

//LiNK

Montreal
Offline Offline
Edison Member
*
Karma: 23
Posts: 2486
Per aspera ad astra.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

More video:




 
« Last Edit: October 07, 2012, 09:19:58 pm by Magician » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Very cool! thanks for sharing, and a nice blog!  smiley
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Really nice and extremely interesting project.

I am hoping to learn a great deal by studying your code. However I have a few questions that hopefully you won't mind answering.

Why do you constrain the values for the Y servo to 1500, 2100 and the X to 800, 1900?
So could i use the following to convert it to degrees?
Code:
rot = map(srvoPosn[y], 1500, 2100, 0, 180);

Also with regards to these lines,

Code:
if(faza[ind][i + MIRROR/2]) Serial.print(faza[ind][i + MIRROR/2]);
         else     Serial.print("n");

if the debug just prints "n" does it mean it is not correctly receiving audio?

Sorry for the very basic questions im just trying to understand the reasons behind what your doing and hopefully get a greater knowledge of FFT

Thank you
John
« Last Edit: January 24, 2013, 07:30:01 am by johnfraiser » Logged

Montreal
Offline Offline
Edison Member
*
Karma: 23
Posts: 2486
Per aspera ad astra.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Why do you constrain the values for the Y servo to 1500, 2100 and the X to 800, 1900?
To keep wiring safe, power cable to board coming up from accumulators. It also good idea to put separate switch for servo motors, to prevent accidents during start up., or use a "delay switch"
Quote
So could i use the following to convert it to degrees?
Code:
rot = map(srvoPosn[y], 1500, 2100, 0, 180);
. Yes, srvoPosn will hold integrated value of the angle, if you keep same hardware set-up - motors moving with platform. Angle would depends on base positioning.  May be not very accurate, depends on servo specification non-linearity etc.
Quote
if the debug just prints "n" does it mean it is not correctly receiving audio?
Mark "n" easy distinguish in digits column, compare to "0" , if "n" printed - there is no data.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ok thats good I thought the mapping would work however was not sure. The setup I am using is slightly different to your in that I am not actually using any servos. I just wish to create a visualisation of the angle from the stationary base. Would this cause any issues with the data I am getting?

I shall have to try and understand then why I am not receiving any data as I seem to be receiving "n" .

« Last Edit: January 24, 2013, 11:08:30 am by johnfraiser » Logged

Montreal
Offline Offline
Edison Member
*
Karma: 23
Posts: 2486
Per aspera ad astra.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I am not actually using any servos.
No, it 'd not work, motors is part of "negative feedback" loop.
You should calculate angle via arcsine(summa). I've mention this in section 3 of the blog,
"Absolute direction to sound source, and must include stage #5 – angle calculation via known delay time. Math is pretty simple, acrsine function, and at this point in program only one calculation per several frames would be necessary, so floating point math wouldn’t be an issue at all. No LUT, scaling, rounding/truncation. Elementary school geometry knowledge – thats all you need."
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Montreal
Offline Offline
Edison Member
*
Karma: 23
Posts: 2486
Per aspera ad astra.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

There are 2 lines :
Code:
           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:
  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/
 
Logged

Pages: [1] 2   Go Up
Jump to: