Play Sound File VI

Owning Palette: Sound Output VIs

Requires: Base Development System

Opens a file and starts playing it immediately.

(Windows) You must have DirectX 8.0 or later to use this VI. (Linux) You must have the Open Sound System (OSS) driver to use this VI.

Example

 Add to the block diagram  Find on the palette
device ID is the input or output device you access for a sound operation. In general, most users should select the default value of 0. The value ranges from 0 to n–1, where n is the number of input or output devices on the computer.
path specifies the absolute path to the file from which you want to play sound data. If the path is empty or invalid, the VI returns an error. The default is <Not A Path>.
error in describes error conditions that occur before this node runs. This input provides standard error in functionality.
timeout (sec)specifies the time, in seconds, that the VI waits for the sound operation to complete. The default is 0. This VI returns an error if the time elapses, unless timeout (sec) is 0. If you set timeout (sec) to 0, this VI returns immediately while the sound continues to play. You can use the Sound Output Wait VI to wait for playback to complete. If you set timeout (sec) to -1, this VI waits until the sound finishes playing.
task ID returns an identification number associated with the configuration on the specified device. You can pass task ID to other sound operation VIs.
error out contains error information. This output provides standard error out functionality.

Example

Refer to the Sound Player VI in the labview\examples\Graphics and Sound\Sound directory for an example of using the Play Sound File VI.

 Open example  Find related examples