system.util.playSoundClip

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

Syntax

system.util. playSoundClip( wavFile )

  • Parameters

String wavFile - A filepath or URL that represents a wav file

  • Returns

nothing

  • Scope

All

Syntax

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

  • Parameters

byte[] wavBytes

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

All

Syntax

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

  • Parameters

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

All

Code Examples
Code Snippet
# 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")
Code Snippet
# 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)