# Function Reference

# SoundPlay

Play a sound file.

SoundPlay ( "filename" [, wait = 0] )

## Parameters

filename | Name of the file to be played (typically a WAV or MP3)
wait | [optional] This flag determines if the script should wait for the sound to finish before continuing: $SOUND_WAIT(1) = wait until sound has finished $SOUND_NOWAIT(0) = continue script while sound is playing (default) Constants are defined in "AutoItConstants.au3".

## Return Value

None. (Always returns 1 regardless of success.)

## Remarks

Terminating the script will stop the sound (if it is still playing).
Calling SoundPlay("") can be used to stop a currently playing sound. This has the side effect of also closing the open handle.
If you need to delete a sound file which you have played in the script, you should call SoundPlay("") first to ensure the handle is closed.

## Related

Beep, SoundSetWaveVolume

## Example

    SoundPlay(@WindowsDir & "\media\tada.wav", 1)