From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I find out a real system time when sound starts in a PDA?

Solved!
Go to solution

Hello all!

 

I want to create a program which may be useful as distance meter. I have PDA with mic and speaker so I can use it as sonar in audible range.

 

The problem arises when I try to find out the certain moment of time when my acoustic impulse starts to sound. This is very important to know exact time of impulse starts because it influences on reflected impulse recognition quality.

 

If I use special functions like "Get System Time" or "Ms timer value" I usually get incorrect results.

First of all my program starts to record, then after 100 ms impulse starts and then after 200 ms program stops recording and saves data.

I get RecStartTime, SndStartTime, so I can calculate how many data points in my record are before impulse: (SndStartTime - RecStartTime)*44,1.

But I always find impulse start in my test records much later.

 

So I don't think that "Ms timer value" can be used to find out the exact time moment of sound starts (really starts).

 

How I can avoid this problem?

 

Thank you.

0 Kudos
Message 1 of 7
(3,718 Views)

Hi Ykk2k8,

 

What language are you programming in?  What NI hardware and software are you using?

 

Thanks

Ryan T
National Instruments
Applications Engineer
0 Kudos
Message 2 of 7
(3,674 Views)

Hello, Ryan!

Thanks for your attention!

 

I use LabVIEW 8.6 for PDA with HP iPAQ 214 Enterprise Handheld (it has microphone and speaker).

I think that I can't get correct time of sound start because of operating system functioning pecularities: I can get time moment when I send sound data to the sound card but I can't exactly fix the time when my acoustic impulse starts to sound...


Maybe I have to use special impulse with one big peak before cosine wave (peak, then silence 10 ms and then impulse of fixed frequency) to simply find (recognize) a moment when my impulse starts and ends...

 

Waiting for your answer.

0 Kudos
Message 3 of 7
(3,671 Views)

Hello,


How far is your sound travelling?  According to Google, the speed of sound at sea level = 340.29 m / s.  This means it will travel 1 meter in about 3ms.  If your distance is much shorter than this, then it's possible that the sound is coming back to your microphone faster than the accuracy of the system clock.  The system clock on any windows system is no more accurate than 1ms, so you won't be able to measure anything faster than that.  

 

Maybe I don't understand your problem well enough

Message 4 of 7
(3,644 Views)
Solution
Accepted by topic author Ykk2k8

I'm not really sure that a Microphone and speaker are accurate enough of a method to measure distance.  Perhaps you should consider a hobby ultrasonic sensor.  I used a bunch of these things in College and it worked really well.

 

0 Kudos
Message 5 of 7
(3,642 Views)

Thank you for answer, David!

 

Yes, I saw a device which measure distance by using ultrasonic waves at one exhibition, but now I have a challenge to create such meter on a PDA platform with microphone and speaker.

Of course, it can't be as accurate as special devices, but my tests show that I can measure distance with +-30 cm accuracy.

By now I record sound and then find moment when impulse starts manually, so the problem is to automatically find position in a record where acoustic impulse starts. After that I can easily find reflected impulse with aid of wavelet transform or correlation analysis - as I do now and get +-30 cm accuracy.

0 Kudos
Message 6 of 7
(3,629 Views)

That is pretty interesting that I works so well for you, I've never heard of anyone doing this but it's a very cool use of a PDA.  As for finding this automatically, it's probably just a matter of analyzing the signal with some Signal Processing VIs or even just math/array functions.  Calculate where the pulse starts and you're set.

Message 7 of 7
(3,593 Views)