LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Unwanted time delay from DAQ assistant need alterative

I’m making a program (labview 8.2) which uses a DAQ board (USB-6251) to get continuous input from a CD player and output it to a set of ear phones. The problem I am having is when I use the DAQmx assistant VIs (program 1) I get a four second delay between the input and the output, which is unacceptable. I was told if I used low level functions I could eliminate the delay, but now that I made the changes I can’t get the program (program 2) to work. When I try to run it, I get error messages or the program will run but no sound is produced in the ear phones so I can’t even test for the delay. Please take a look at my code and tell me what you think. Btw the top part of program 2 is the input section & the bottom part is the output section. For program 2 sample rate was set at 50 kHz (at least 44 kHz is need for CD quality), samples per channel was set at 80 kHz (not real sure what’s a good value for this), and max & min were set to 10 & -10.

Download All
0 Kudos
Message 1 of 3
(2,780 Views)
Hey jaded,

Thanks for contacting National Instruments support.  I have looked over your program2.vi and there are a few issues with it.  I would suggest looking at one of our example programs for this application.  It is located at C:\Program Files\National Instruments\LabVIEW 8.2\examples\DAQmx\Synchronization\Multi-Function.llb\Multi-Function-Synch AI-AO.vi

You need to acquire your data and write it to the onboard buffer before you start the output task.  So the example I refer to would need some modification to make that happen, but it should be able to be done.  There will be delay because of this however. 

Are you planning to do some processing on this data later?  I'm just curious why you are going through the DAQ card.

You could also acquire the waveform with sound vi's from the sound card as well.  That may have better results.

Regards,
Kenn North
Principal Product Manager - Search, Digital Analytics
http://ni.com/search
0 Kudos
Message 2 of 3
(2,752 Views)
I agree with Kenn that using lower level function calls to the DAQmx driver will give you more flexibility and power. However, another thing to consider is something that you can manipulate in your original example using the DAQ Assistants.

Notice that you are specifying to read 85,000 samples at 80kHz every time the DAQ Assistant runs. Just do the math and you'll see that that operation takes over a second to complete. So right away your output is over a second later than your input. You can drastically improve performance by setting the number of samples to read to be something comparably small like 1000. Basicly, the smaller the input buffer, the lower the delay for the output loop. You have to be careful here, though, because reducing the input buffer size can cause buffer overflows if you aren't able to read the data quickly enough. So you don't want your buffer to be too small.
Jarrod S.
National Instruments
0 Kudos
Message 3 of 3
(2,749 Views)