LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

help with timing, input from Daq, output sound

Hi

 

I am a student member of OSA, working on a laser listener project to be used in examples for high schools students. It is a pretty old and simple experiment but something I think students would be into. {any suggestions for other experiments anyone might have I would love to hear} 

I read a voltage from a Daq off a reciever circuit, that signal is noisey so I filter it for the human voice range, 60Hz - 2000Hz. Then that filtered signal goes to the play waveform express VI. It works but the snag is I keep getting a "beeping" in the output sound, I believe this is from the loop cycling.  I have thought of something like a master/slave loops, storing the data in an array then waiting a sec or two and playing the sound from this data so I dont have to wait on the Daq to acquire new data. Any help or suggestions are greatly apprciated.

 

This is a rough version sorry about the mess. I think it should also be noted that if the "Time Duration" is larger that 0.02 then that makes the number of samples larger than what the Daq can handle.

 

Thank you very much in advance for all of the help and your time.

Jason

0 Kudos
Message 1 of 5
(2,399 Views)

Hi Jason,

 

Before you try to move to a more complex program architecture, I would suggest that you move the DAQmx Create Task and Clear Task VIs outside of the while loop. Calling these functions each time the loop iterates creates uncessary computational overhead in the program. You may find it helpful to browse through some of the examples that ship with LabVIEW and DAQmx by going to Help > Find Examples > Hardware Input and Output > DAQmx > Analog Measurements > Voltage. Any of the continuously acquire (Cont Acq______.vi) examples should serve as a good reference. You'll notice that for these examples, the VIs with configuration and clear the DAQ task are done outside the while loop. Hope this helps you resolve the issue, and if not, let me know and we can do some further tweaking to your code. 

Message 2 of 5
(2,379 Views)

So sorry about that, great catch. The "clear/..ect" problems were a copy/paste error. I took the contents from a larger program and put the while loop around everything by mistake. In my original code they are set-up like what you would see in the typical Daq examples.  I did try your suggestion and tweeked it so it is more like the "continous Daq example", overall I seem to get the same functionallity. I think I am having the same thing using the "express sound VI" should I avoid using this as well? The only thing I can think of is to store the data in an array and play the sound on a slight delay, but I would rather not have to use a delay. Again thank you very much for your help.

 

jason

0 Kudos
Message 3 of 5
(2,357 Views)

Hi Jason,

 

I took a look at what is happening in the play waveform express VI and the issue may be related to starting/stopping the sound card every time the loop iterates, similar to what I suggested with the DAQmx VIs in my previous post. To look into the code behind an express VI, you should copy the express VI to another section of your code or to another VI completely, because once you show the block diagram for it, you will not be able to use the express VI configuration dialog anymore for that instance of the VI. Once you copy the play waveform express VI, right click on the copy and select "Open Front Panel." Then, navigate to the block diagram and keep opening the subVIs until you find the "Simple Write" VI (see below for a screenshot of this VI). Here, you will see that there is a "Sound Output configure" VI as well as a "Sound Output Clear" VI. Since these are within the while loop of your top level VI, the "beeping" in your output may be caused by the constant configuring and stopping of the sound card with these VIs. What I suggest is that you use the code in the express VI as an example to code your own sound output vi that is configured once outside the while loop and stopped once after the while loop. Hope this helps!

 

simple write.png

 

 

 

Message 4 of 5
(2,345 Views)

Thank you very much. I have taught my self LabView, lol I didnt know you could do that to the Prebuilt VI's. That is kinda what I thought it was doing but I was not sure how to get to that point. Sorry for the stupid questions, but your help was greatly appreciated.

 

jason

0 Kudos
Message 5 of 5
(2,332 Views)