LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to do real-time (tens of milliseconds) quantative frequency analysis on sound in the ultrasound region?

As part of a undergraduate Physics project I am trying to use cheap microphones and speakers for Doppler velocimetry with focus on gesture detection. Similar experiments have been done before, so it should be possible.

 

I am able to do this using Express VIs; I set up a while loop with a sinusodial signal generated connected to the "play waveform" VI to produce a pilot tone at 20 kHz that plays continuously. Then, by connecting the "Acquire Sound" express VI to the "Filter", "Spectral measurements", and the "Peak Detector" VIs (in that sequence) in a second while loop, the program is able to distinguish between a gesture towards the microphone and a gesture away from it. The last part is crudely implemented by comparing the peak location aquired from the peak detector to the known such location of the pilot tone.

 

The problem with this setup is that the speed of the program, as in the rate at which it finds and compares peaks, seems to be limited by the "duration" setting of the "Acquire Sound" express VI. I am unable to set the duration to lower than 0.3 seconds before the acquire sound VI seems to stop producing data (in lack of better ways of expressing it) and the power spectrum goes flat. Does anyone know why this is the case and how I can prevent it? If it could run about ten times faster it should be enough, as the precision will be limited by the hardware. Merging the two while loops causes the program to run even slower and then crash.

 

 

 

One way I am trying to circumvent this problem is by using lower level VIs to acquire sound (see the attached code). This seems a lot more promising as the plotted power spectrum responds very quickly to changes in frequency. The problem with this is that for some reason the peak detection VI does not detect any peaks, at least not when I wire it the way I have in the attached code, despite the fact that I can clearly see peaks in the power spectrum. Can anyone tell me what I am doing wrong?

 

From my request and especially from the attached code it is probably obvious that I am very inexperienced with Labview, which I assume is really the root casue of these problems. The tutorials I have found, while useful, have not helped me understand the specific problems I have encountered.

 

Many thanks for any support you are able to provide.

 

 

 

    

0 Kudos
Message 1 of 4
(2,623 Views)

Well, you are asking for 100kS at a rate of ~22kS/sec.  That is ~4.5 seconds worth of data that you are asking for from the sound card.  That is what is making your system slow.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 4
(2,609 Views)

 


@crossrulz wrote:

Well, you are asking for 100kS at a rate of ~22kS/sec.  That is ~4.5 seconds worth of data that you are asking for from the sound card.  That is what is making your system slow.


 

I am afraid I do not quite understand what you mean (I am not overly confident about the workings of computers). If there is a limit on the rate of data acqusition imposed by the sound card, why is the program that is not using the express VIs not that slow? Is there any way to make the "Acquie Sound" VI less taxing on my sound card?

 

Thanks for your support.

0 Kudos
Message 3 of 4
(2,598 Views)

@averageaxel wrote:

 


@crossrulz wrote:

Well, you are asking for 100kS at a rate of ~22kS/sec.  That is ~4.5 seconds worth of data that you are asking for from the sound card.  That is what is making your system slow.


 

I am afraid I do not quite understand what you mean (I am not overly confident about the workings of computers).


Data Acquisition 101.  It takes time to take data.  YOU told the sound card to acquire data at ~22kS/s.  YOU asked for 100k samples each loop iteration.  Therefore YOU asked for 4.5 seconds worth of data each loop iteration.  If you want the iterations to go faster, you need to either 1) increase the sample rate and/or 2) decrease the number of samples you acquire with each read.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 4
(2,587 Views)