LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I get continuous sound input through an audio card?

Is there a way to get continuous acquisition with an audio card? NI's standard sound VI not only doesn't seem to have this ability, but it takes twice as long to record a sound as the length of the recording time.

Here's an example of that happening:

http://www.lctechnology.com/Sound_Test.vi

If I could at least figure out how to record almost 100% of the time with the above VI, instead of almost 50%, that would probably do.
0 Kudos
Message 1 of 3
(4,042 Views)
I looked at your Vi. I have done sound acquisition using LV in past. Your problem happens to be the Buffer size.
You want to acquire sound at the rate of 11025 samples/second. But then you set the buffer size to 22050. Labview will wait for this buffer to be full before returning you the results. The time therefore is 2 seconds based on your rate. My suggestion is to reduce the buffer size to something to the order of not more than 4000 samples. Of course this will put some load on the processor. You may have to play with this number.

A second more Important thing to do is to use Vi's in Sound Input and Sound Output palette instead of Snd Read Waveform and Snd Write Waveform. If you open the vi's that you are using and look at their diagram, they comprise of Vi's form the palette I suggested. So every time you are reading a waveform. You are configuring, Starting, Reading and closing. Instead Do Config, Start outside the while Loop, Read in side the loop and when you exit the loop, Stop and close the connection. More efficient and certainly works.

Let us know how you make out.
Good Luck!

Mache
Message 2 of 3
(4,038 Views)
Using those lower level VIs solved the problem for me, thanks.

Bruce
0 Kudos
Message 3 of 3
(4,025 Views)