SoundEffect
Extends Node
The SoundEffect node class is used to play audio sound effects that can be triggered from events that occur in the UI. Typically, these sound effects are short audio clips, but there is no inherent limit on their length. Currently, up to four simultaneous sounds can be playing at any time, in addition to audio from streaming content and TextToSpeech audio.
Files can be installed locally as part of the package file or dynamically downloaded from the network. All files must be WAV (i.e. PCM) format.
For local files, the convention is to include the WAV files in a directory named "sounds".
For downloaded files, a least-recently-used (LRU) mechanism is used to keep the most recently downloaded/played sounds in temporary storage on the device. If the limits on the maximum number/size of downloaded sounds is exceeded, the least recently used sounds are removed from temporary storage. They will be automatically reloaded the next time the control field is set to "play".
A sample demonstrating how to use the SoundEffect node can be found here: SimpleSoundEffect
Fields
| Field | Type | Default | Access Permission | Description | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| uri | uri | READ_WRITE | Specifies the URI of the WAV file. Sounds included as part of the application package can be referenced using the pkg:/sounds prefix. This may also specify the location of a WAV file on a remote server. |
|||||||||||||||
| control | option string | none | READ_WRITE | Set to control the audio playback. Getting the value of this field returns the most recent value set, or none if no value has been set.
|
||||||||||||||
| state | value string | none | READ_ONLY | Can be used to track the progress of current state of local and networked sound files When the field value changes to ready, the sound is ready to be played. The possible values are:
|
||||||||||||||
| loadStatus | value string | none | READ_ONLY | Indicates the status of the sound file.
|
||||||||||||||
| volume | integer | 50 | READ_WRITE | The volume is a number between 0 and 100 (percentage of full volume). 50 should be used for normal volume. |
Updated 3 months ago
