# Voice Message service definition

The Voice Message service is a Natural Access service for developing voice applications. You must have Natural Access installed on your system to build applications using the Voice Message service. For detailed information about Natural Access, refer to the Natural Access Developer's Reference Manual.

The Voice Message service:

- Provides a set of functions for playing, recording, and editing voice messages in files or memory.

- Supports NMS VOX files, WAVE files, and flat (unformatted) files.

- Provides advanced functions for playing a list of concatenated messages and assigning message numbers to segments of an open file or a memory block.

- Uses the ADI service play and record functions.

To use the Voice Message service with the ADI service, open both services on the same context. Refer to the ADI Service Developer's Reference Manual for more information about the ADI service play and record functions.

Refer to the d emonstration programs that use the Voice Message service play and record functions.

## Voice file types

The Voice Message service supports the following voice file types:

- NMS VOX file format. This file format stores multiple messages in one file and enables messages to be deleted, added, edited, and annotated. Refer to Overview of VOX file format and VOX file information: voxinfo for more information.

- Waveform audio file format (WAVE) files. Refer to the Microsoft Windows MultiMedia Programmer's Reference Manual for information about the WAVE file format.

- Flat files that contain no header or format.

## Voice encoding formats

When recording speech files, you must select an encoding format. The primary issue to consider when selecting a format is the compression ratio and fidelity. More aggressive compression requires less disk space and reduces host-to-board loading, but uses more DSP resources.

On heavily loaded systems, the throughput requirements between the host and the board can cause gaps, called an underrun condition, in the voice record or playback. Failure to maintain pace with the board can also cause underruns in the voice record or playback. Greater compression may be necessary in this case to eliminate the problem.

The ADI service opened on the same context determines what type of voice encoding is supported. For information on attaching the ADI service, refer to the ADI Service Developer's Reference Manual.

Each encoding format has a minimum data block size that is called a frame. Frames vary in size and duration depending on the encoding format. For NMS boards, a frame corresponds to 10 or 20 milliseconds of speech, depending on the encoding.

Note: If you are using an AG or CG board, refer to the adiPlayAsync function in the ADI Service Developer's Reference Manual. A table in the topic lists the DSP files that must be loaded on the AG and CG boards depending on the encoding type. It also lists the valid encoding types that QX boards and PacketMedia HMP processes support.

The encodings refer to the data going to and from the host, typically stored in a voice file. Except for VCE_ENCODE_NMS_64, this host encoding is independent of the line encoding, which is always either mu-law or A-law, depending on how the board is configured when it is initialized.

Note: The ADI service has equivalent encoding formats that begin with ADI_.

### EDTX encoding types

EDTX encoding types specify the NMS proprietary EDTX storage format for playing and recording audio to and from packet networks using the native RTP packet payload format. The EDTX encoding types support only files of type VCE_FILETYPE_FLAT or VCE_FILETYPE_VOX. For more information about native play and record, refer to the ADI Service Developer's Reference Manual.

EDTX encoding uses frames that include individual headers. The frames can have variable frame sizes and represent variable times. The following functions assume a fixed frame size and are currently not supported with EDTX encoding:

- vceRead

- vceWrite

- vceRecord

- vcePlay

- vceErase

- vceConvertMessage

Refer to Encoding descriptions and to Encoding and WAVE information.

## Messages

A voice file or memory block can contain zero, one, or multiple messages, depending on the file type. A message is a logical, contiguous block of speech identified by an unsigned number. Messages can be created in an open file or memory block by recording or copying to it. Unstructured formats (flat files, memory) contain only message 0 (zero) when first opened. Other messages can be defined by using vceDefineMessages.

The file type determines the range of valid message numbers:

File type | Range of valid message numbers
VOX | 0 to 32,767
Flat | 0 to 65,535
WAVE | 0 only
Memory | 0 to 65,535

All unused (or deleted) message numbers in the valid range refer to zero-length messages and do not result in an error when referenced.

The special message number VCE_ALL_MESSAGES enables you to operate on all messages in a file or memory block as one message. Use this message number to copy all messages, play all messages, or erase all messages. You cannot record or write to this message number.