04-23-2013 11:09 AM
Hi,
Is there a way to play one wav file if switch 1 is pressed and to have it play only once and then play a second wav file if swicth 2 is pressed? I cant find an example on any forum and I am new to Labview.
Thanks in advance.
04-23-2013 11:28 AM
I have two reed switches connected to the analog inputs of a USB-6009 DAQ. I would like a wav file saved on my computer to play when switch one is activated and for the entire file to play; I would also like to play a second file if switch 2 is activated. Switch one will remain on until the end.
04-23-2013 12:28 PM
Yes, you can do this quite easily with the VIs in the Sound palette but I doubt you're going to find a ready made example. Post the code you've tried and we can show you where you're going wrong...
04-23-2013 12:32 PM
Hi,
Thanks for your reply. I have posted a VI I am currently working on. I can play the wav file if I press the play button in the front panel. I can acquire the voltage signal that I need using the DAQ assistant. Now I need a way to convert the voltage signal into a digital signal (ie if voltage above 1v, then 1) and for this to activate the sound file. I can then repeat this for the second sound file.
Thanks.
04-23-2013 01:23 PM - edited 04-23-2013 01:26 PM
Well, there are about as many ways to do this as there are LabVIEW programmers but you can certainly make your VI much simpler as a start.
Why do you want to use analog? Why not just use the digital inputs of your USB-6009? It has 12, you could make your own one octave keyboard! If you want to use the analog in just use the Greater Than VI in the comparison palette to output a boolean.
If you can use digital just open the example called Digital - SW - Timed Input.vi. It reads the DAQ digital ins and displays an array of booleans that can be toggled with the physical switches. As you can imagine, from that point it is easy to trigger different wave files by using a simple case structure.
EDIT: forgot to mention that you should do this all in ONE LOOP. Don't complicate things when you don't have to.