Skip to main content
Version: 7.9

system.util.playSoundClip

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 byte[].

Client Permission Restrictions

This scripting function has no Client Permission restrictions.

Syntax - Using a Byte List

system.util.playSoundClip(wavBytes [, volume] [, wait])

Parameters

TypeParameterDescription
byte[]wavBytesA byte list of a wav file.
doublevolumeThe clip's volume, represented as a floating point number between 0.0 and 1.0 [optional]
booleanwaitA boolean flag indicating whether or not the call to playSoundClip should wait for the clip to finish before it returns [optional]

Returns

Nothing

Scope

Client

Syntax - Using a Filepath or URL

system.util.playSoundClip(wavFile [, volume] [, wait])

Parameters

TypeParameterDescription
StringwavFileA filepath or URL that represents a wav file.
doublevolumeThe clip's volume, represented as a floating point number between 0.0 and 1.0. [optional]
booleanwaitA boolean flag indicating whether or not the call to playSoundClip should wait for the clip to finish before it returns. [optional]

Returns

Nothing

Scope

Client

Code Examples

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")
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)