Audio Command

Lightwing can play Wave format audio files through the Linux ALSA interface. The Audio command defines parameters required to open and play audio files on a page. Up to 8 audio files can be played simultaneously and these are defined as stream 0 through stream 7. The start of each audio can be controlled by either time options or by state changes in associated toggle touch controls by using the toggle option.

The Audio command can also be used on the global page to make the audio available across multiple pages without interruption. Audio streams are completely independent of video streams. The default audio stream is zero.

The only mandatory parameter for the audio command is an audio name. This file name must include the extension .wav, which defines the codec type of the audio to be the uncompressed Wave (PCM) format.

Audio is not currently implemented in the Windows version of Lightwing, so this command is ignored on Windows.

Example of a Page with Background Audio

        page: FirstPage    time: 1, 10
            audio: Music.wav    stream: 0    loop: on

Time Option

Defines the start and duration times for the audio to play in seconds. If not specified, the default start and duration times will be the same as for the page. These can be specified as either floating-point values in seconds or integer (sexagesimal) clock time durations. Refer to the page command for examples.

Start times can be prefixed with a plus symbol (+) which means the new start time is the sum of the specified start time and the start time from the previous audio command on the same page.    This allows audio commands to be duplicated in the script without the need to manually add time values.

Stream Option

Defines the stream number to play the audio. Lightwing supports up to 8 simultaneous audio streams. The default stream is zero. More than 8 audio commands can be used on a page, but this could cause conflicts if their play times overlap. If multiple audio commands are used on a page, the best practice is to assign each to a different stream in order to prevent conflicts. When audio is played on a stream that is already busy, the playing audio will be interrupted with a delay of up to one second and this can affect the starting time of the new audio.

Loop Option

Defines if the audio will repeat in a continuous play loop.  This parameter can be either on or off.  The default is off. 

Toggle Option

Defines a toggle control which enables and disables the audio. This allows audio to be controlled by touch events on an associated toggle control. If a toggle control name is specified with this option, the audio will play whenever the toggle control’s state changes from inactive to active. This toggle control name must be defined either on the same page or the current global page. However, toggle controls can be defined before or after the Audio command on the same page.

Example of a Button with Audio Controlled by a Toggle Touch Control

        page: FirstPage    time: 1, 10
            box: Button  position: 10, 10  size: 10, 10  color: 1.0, 1.0, 1.0
            toggle: Button  box: Button  stick: on
            audio: Button.wav  stream: 1  toggle: Button

 

<   Scripting Guide                                              Box Command   >