From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Stopping an audio file

If I were to play audio file. Say using a simple read and a play waveform, is there anyway to stop the waveform from playing mid track. The idea is to play a song while I loop is running a motor. When the conditions stop to motor they need to stop the waveform from being played. Any ideas?
0 Kudos
Message 1 of 4
(3,303 Views)

How about the Sound Output Stop VI???

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019 - Unfortunately now moving back to C#, .NET, Python due to forced change to subscription model by NI. 8^{
0 Kudos
Message 2 of 4
(3,289 Views)

Ok so I see that option. My question then becomes how do you control when it stops the song. If I say wanted to stop the song when a loop finished and so I brought a true statement out and want that to tell the sound file to stop. The help for that icon is very sparse in its explanation of how it is used. Thanks!

0 Kudos
Message 3 of 4
(3,277 Views)

The help assumes you know basic LabVIEW.  It can't provide much specific usage info since it doesn't know what the programmers intentions are.  This is common in all languages.

 

This is a very easy "case" though.  Use a case structure in a loop.  Wire your boolean control to it and put the Play VI in one case and the Stop VI in the other.  Toggling the boolean control will turn the sound on and off.

 

Check out the LabVIEW examples for some good, sound ideas.  Help > Find Examples... Hardware IO > Sound.  If the examples seem confusing look into some basic LabVIEW tutorials.

 

BTW: You could also control the sound output by using a volume control in your loop.  That way you could fade in and out if you want to be fancy. Smiley Wink

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019 - Unfortunately now moving back to C#, .NET, Python due to forced change to subscription model by NI. 8^{
0 Kudos
Message 4 of 4
(3,263 Views)