voiceTalk (Function)

Top  Previous  Next

Architecture:

X32 / NX32 / NX32L

Device support:

All with voice/DTMF capability

Firmware version:

1.00 / 1.00.00


 

This function will play a pre-recorded voice message over the cellular module on the device. This functionality is useful for implementing voice/response systems in combination with the DTMF API.

The voice system has an queue of messages. When a new message is to be played, it is placed in this queue. The maximum number of voice messages in the queue is 32.

For an example program using the voiceTalk function, please look at the example below or look at the voicemessage example in the Examples section

 

If the specified message does not exist, a default "beep" message will be played.

 

On NX32L devices (from firmware R1.30.00)  it is possible to play voice messages from locations other than the project drive.

The full path to the voice file is required. For example: "B:\voice\message.wav".

 

The following audio formats are supported:


X32

NX32

NX32L

Sample rate:

4 kHz, 8kHz

4 kHz, 8kHz

4 kHz - 48kHz

Data bits:

8

8

8, 16, 24

Channels:

Mono

Mono

Mono, Stereo

Formats:

WAV

WAV

WAV, FLAC*, Ogg Vorbis*

* Requires runtime-firmware 1.80.00 or newer.

 

 

Input:

message : STRING

The name of the wav file to play.

 

pause : INT (0..25000) Default 150

0..25000 : The number of milliseconds to wait after this message is finished, before the next message starts.

 

Returns:

None

 

Declaration:

FUNCTION voiceTalk;
VAR_INPUT
  message : STRING;
  pause   : INT := 150; // Wait default 150 mSec before next message
END_VAR;

 

 

Example:

INCLUDE rtcu.inc
 
VAR_INPUT
  configured_message : STRING; | Voice message
END_VAR;
 
PROGRAM test;
 
BEGIN
  ...
  // Play the "Hello" message, and after the message finishes, wait 250 milliseconds
  voiceTalk(message := "Hello.wav", pause := 250);
  // Play the "Menu" message, 150 mSec between this and the next message in queue
  voiceTalk(message := "Menu.wav");
  // Play the configured message, no delay between this message and the next (no one in this example)
  voiceTalk(message := configured_message, pause := 0);
  ...
END;
 
END_PROGRAM;