--- title: "system.util.playSoundClip" description: "Plays a sound clip from a wav file to the system's default audio device." --- # system.util.playSoundClip > Plays a sound clip from a wav file to the system's default audio device. This function is used in **Python Scripting**. ## Description Plays a sound clip from a wav file to the system's default audio device. The wav file can be specified as a filepath, a URL, or directly as a raw List[Byte]. ### A Word on Scope While this function is technically scoped for Gateway and Perspective Sessions, it's intended for use in Vision Clients. When calling this function from the Gateway scope, the sound will not play unless the operating system has been configured to allow services to play sounds (an uncommon scenario). When calling this function from Perspective, the script also executes on the Gateway, meaning the caveat above about allowing services to play sounds is a factor. In addition, the sound will play on the Gateway, not the session. To play sounds from a Perspective Session, it's recommended to use the play() component method on the [Perspective Audio](../../components/perspective-components/perspective-display-palette/perspective-audio/perspective-audio.md) component. ## Client Permission Restrictions This scripting function has no [Client Permission](../../../ignition-modules/vision/vision-project-properties/vision-project-properties.md#vision-permissions-properties) restrictions. ## Syntax - Using a Byte List `system.util.playSoundClip(wavBytes, [volume], [wait])` ### Parameters |Type | Parameter | Description | |------- | ------- | ------ | |List[Byte]| `wavBytes` | A byte list of a wav file. | |Float| `volume` | The clip's volume, represented as a floating point number between 0.0 and 1.0. [optional] | |Boolean | `wait` | A boolean flag indicating whether or not the call to playSoundClip should block further script execution within the triggering event until the clip finishes. Useful in cases where code on lines after the playSoundClip call should wait until the sound clip finishes playing. [optional] | ### Returns Nothing ### Scope Gateway\*, Vision Client, Perspective Session\* \*See [A Word on Scope](#a-word-on-scope) above. ## Syntax - Using a Filepath or URL `system.util.playSoundClip(wavFile [, volume] [, wait])` ### Parameters |Type | Parameter | Description | |------- | ------- | ------| |String | `wavFile` | A filepath or URL that represents a wav file.| |Float| `volume` | The clip's volume, represented as a floating point number between 0.0 and 1.0. [optional]| |Boolean | `wait` | A boolean flag indicating whether or not the call to playSoundClip should block further script execution within the triggering event until the clip finishes. Useful in cases where code on lines after the playSoundClip call should wait until the sound clip finishes playing. [optional]| ### Returns Nothing ### Scope Gateway\*, Vision Client, Perspective Session\* \*See [A Word on Scope](#a-word-on-scope) above. ## Code Examples ```python title="Example #1" # This code would play a sound clip at full volume that was located on the current # host's filesystem. It will not return until the clip in finished playing. system.util.playSoundClip("C:\\sounds\\siren.wav") ``` ```python title="Example #2" # This code would pull a sound clip out of a BLOB field from a database, # playing it asynchronously at half volume. query = "SELECT wavBlob FROM sounds WHERE type='alert_high'" soundData = system.db.runScalarQuery(query) system.util.playSoundClip(soundData, 0.5, 0) ```