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
Type | Parameter | Description |
---|---|---|
byte[] | wavBytes | A byte list of a wav file. |
double | 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 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
Type | Parameter | Description |
---|---|---|
String | wavFile | A filepath or URL that represents a wav file. |
double | 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 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)