04-16-2018 10:22 AM - edited 04-16-2018 10:33 AM
Hi LabVIEW community
i have been trying to play a sound by LabVIEW functions. I did it, but i've got a problem. When i condition the reproduction by a button, i can play the sound once time, when i try to reproduce one more time, it doesn't work. can somebody help me?
i'll ad the VI and a zip file with the .wav
Solved! Go to Solution.
04-16-2018 10:44 AM
You are reading your wave file inside the loop so it works the first time but the second time there is no data left to read.
Move your Read File VIs outside your loop and just pass the wave data to the Sound VI.
04-16-2018 10:58 AM
Like that?
When i try it, i heard the sound in a infinite loop
04-16-2018 11:22 AM
First run in Finite Mode. Then also take the Write Sound VI outside the loop so you only write the data once.
Then make sure to configure the Sound Output Configure VI with the exact same number of samples as your file signal.
Finally add a Sound Output Start / Wait and Stop inside your loop.
That way you are going to play the exact signal once every time you press your button.
Btw... remember to wire through the False case as well, otherwise you will not pass a valid session to your close VIs.
04-16-2018 11:38 AM
it works, but with a lot of lag response. If i play the sound one time, i need to wait like 2 seconds to play it again.i need to have a very fast response, because this is gonna be a piano application
04-16-2018 12:59 PM
This likely because you have not adapted the number of samples/ch in your configuration VI to your actual waveform length. The default is 100.000 so you'll have to play a little more than 2 sec before you can re-play.