LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Play sound file.vi locks the loop its in for ~1 second

Hi,

 

The play sound file.vi locks the loop its in for an indeterminate amount of time, somewhere between 0.5 to 2 seconds. This only happens when another loop is running in parallel. I need to be able to stop the playback in less than 1 second. Once the play sound file.vi has been used, the start and stop vi's can be used with no slowing of the loop.

 

Is it possible just open the .wav file and not play it immediately?

 

I tried opening the file using the sound file open.vi and creating a task id using the sound output configure.vi but the start sound output.vi would not play the sound following this method for task id declaration. 

 

This is driving me nuts, any help would be greatly apprecitated!

 

Thanks a lot!!

 

0 Kudos
Message 1 of 4
(4,075 Views)

The .wav file is taking awhile to load, is that the issue?  I have never had an issue with a sound file slowing down my loop as much as a second...but I would imagine that would change if I played a longer file.  Try throwing the play sound file in a different thread and using a notificaton:

 

notification for wav file.png

 

Your main loop won't be lagged at all using this method.

 

-nickerbocker

 

Message 2 of 4
(4,067 Views)
I didn't know about the notifiers, completely new at this, and I'm going to change my main loop to send the signal this way instead of using a local variable. Unfortunately my problem is more about being able to stop the .wav file quickly. I need to play a tone a finite amount of time, ideally with fine temporal resolution, ~1 ms, and the play sound file.vi can't be stopped this quickly since its locking the loop. 
0 Kudos
Message 3 of 4
(4,053 Views)

I leave an example that can provide, use it in your program

Message 4 of 4
(3,408 Views)