All pages
Powered by GitBook
1 of 7

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Audio-Sound

playDuration(duration [, hourFormat])

Play a time value (text to speech)

Supported Targets: BW, COLOR

Status: current Introduced in 2.1.0, changed in 2.10

Parameters

  • duration (number) number of seconds to play. Only integral part is used.

  • hourFormat (number):

    • 0 or not present play format: minutes and seconds.

    • != 0 play format: hours, minutes and seconds.

Return value

none

Examples

playDuration(101, 0, 5) -- play duration 101s, seconds format, use Wav volume 5
playDuration(101, 0, 1) -- play duration 101s, seconds format, use Wav volume 1
playDuration(101, 1)    -- play duration 101s, hour format, use radio settings Wav volume

playHaptic(duration, pause [, flags])

Generate haptic feedback

@status current Introduced in 2.2.0

Parameters

  • duration (number) length of the haptic feedback in milliseconds

  • pause (number) length of the silence after haptic feedback in milliseconds

  • flags (number):

    • 0 or not present play with normal priority

    • PLAY_NOW play immediately

Return value

none

playTone(frequency, duration, pause [, flags [, freqIncr]])

Play a tone

Supported targets: BW, COLOR

Status: current Introduced in 2.1.0, changed in 2.10

Parameters

  • frequency (number) tone frequency in Hz (from 150 to 15000)

  • duration (number) length of the tone in milliseconds

  • pause (number) length of the silence after the tone in milliseconds

  • flags (number):

    • 0 or not present play with normal priority.

    • PLAY_BACKGROUND play in background (built in vario function uses this context)

  • freqIncr (number) positive number increases the tone pitch (frequency with time), negative number decreases it. The frequency changes every 10 milliseconds, the change is freqIncr * 10Hz. The valid range is from -127 to 127.

  • volume (number): (1..5) override radio settings Beep volume for the duration of file. Omitting the parameter uses radio settings Beep volume

Return value

none

Examples

playFile(name)

Play a file from the SD card

Supported targets: BW, COLOR

Status: current Introduced in 2.0.0, changed in 2.1.0, changed in 2.10\

Parameters

  • filename (string) full path to wav file (i.e. “/SOUNDS/en/system/tada.wav”)

    Introduced in 2.1.0: If you use a relative path, the current language is appended

    to the path (example: for English language: /SOUNDS/en is appended)

  • volume (number): (1..5) override radio settings Wav volume for the duration of file. Omitting the parameter uses radio settings Wav volume

Return value

none

Examples

PLAY_NOW play immediately
playFile("armed.wav", 5) -- play file armed.wav, use Wav volume 2
playFile("armed.wav", 1) -- play file armed.wav, use Wav volume 1
playFile("armed.wav")	 -- play file armed.wav, use radio settings Wav volume
playTone(2550, 160, 20, 3, -10, 5) -- play tone, use Beep volume 5
playTone(2550, 160, 20, 3, -10, 1) -- play tone, use Beep volume 1
playTone(2550, 160, 20, 3, -10)	   -- play tone, use radio settings Beep volume

flushAudio()

Flushes audio queue

@status experimental, Introduced in 2.8.0

Parameters

none

Return value

none

playNumber(value, unit [, attributes])

Play a numerical value (text to speech)

Supported Targets: BW, COLOR

Status: current Introduced in 2.0.0, changed in 2.10

Parameters

  • value (number) number to play. Value is interpreted as integer.

  • unit (number) unit identifier [Full list]((../appendix/units.html))

  • attributes (unsigned number) possible values:

    • 0 or not present plays integral part of the number (for a number 123 it plays 123)

    • PREC1 plays a number with one decimal place (for a number 123 it plays 12.3)

  • volume (number): (1..5) override radio settings Wav volume for the duration of file. Omitting the parameter uses radio settings Wav volume

Return value

none

Examples

PREC2 plays a number with two decimal places (for a number 123 it plays 1.23)

playNumber(123, 3, 0, 5) -- play number 123, unit mAh, use Wav volume 5
playNumber(123, 3, 0, 1) -- play number 123, unit mAh, use Wav volume 1
playNumber(123, 3, 0)    -- play number 123, unit mAh, use radio settings Wav volume