4.2 Voice Encoding Formats

(Page 3 of 8 in this chapter)
When recording or playing speech files, the application must select an encoding format. The primary issue to consider when selecting a format is the compression ratio vs. fidelity. More aggressive compression requires less disk space and reduces host-to-AG loading.

On heavily loaded systems, the throughput requirements between the host and the AG board may cause gaps in the speech record/playback. This is called an "underrun condition." Greater compression may be necessary in this case to eliminate the problem.

The AG Access library supports multiple file encoding formats which are listed in the table below. The encoding is the suffix for ADI_ENCODE_ names used when writing 'C' code. For example, ADI_ENCODE_NMS_24 is the NMS_24 encoding.

ADI_ENCODE extension

Description

NMS_16

NMS ADPCM 16kbs

NMS_24

NMS ADPCM 24kbs

NMS_32

NMS ADPCM 32kbs

NMS_64

framed PCM 64kbs

MULAW

mu-law 64kbs

ALAW

A-law 64kbs

PCM8M16

PCM 8k mono 16 bit

OKI_24

OKI ADPCM 24kbs

OKI_32

OKI ADPCM 32kbs

PCM11M8

PCM 11kHz 8 bit (Wave format)

PCM11M16

PCM 11kHz 16 bit (Wave format)

G726

G726 ADPCM 32kbs

The AG board processes speech in atomic units called voice frames. Frames vary in size and duration depending upon the encoding format. The following table specifies physical constants for each encoding format.

ADI_ENCODE_
Extension

Sample Size (bits)

Sample Rate (Hz)

Frame Size (Bytes)

Frame Duration (ms)

Throughput (Bytes/sec)

NMS_16

2

8000

42

20

2100

NMS_24

3

8000

62

20

3100

NMS_32

4

8000

82

20

4100

NMS_64

8

8000

162

20

8100

MULAW

8

8000

80

10

8000

ALAW

8

8000

80

10

8000

PCM8M16

16

8000

160

10

16000

OKI_24

4

6000

30

10

3000

OKI_32

4

8000

40

10

4000

PCM11M8

8

11000

110

10

11000

PCM11M16

16

11000

220

10

22000

G726

4

8000

40

10

4000

4.2.1 Buffer Sizes

All play buffers submitted to AG Access must be an integral number of frames for the selected encoding format. For example, if you select ADI_ENCODE_NMS_24, the play buffer size must be a multiple of 62 bytes. Failure to submit a play buffer meeting this size requirement causes the function to terminate with an ADIERR_BAD_SIZE reason. Other than the multiple frame size requirement, buffers submitted to AG Access can be of arbitrary size.

Each AG board has a physical buffer size which is both board and encoding dependent. If you submit a buffer larger than the physical size, AG Access divides the buffer into physical segments and submits those segments to the AG board. To eliminate fractional buffers and to reduce the AG-to-host interactions, the optimum user buffer will be a multiple of the physical AG buffer size. This size is retrieved via the function adiGetEncodingInfo.


(Page 3 of 8 in this chapter)

Copyright 1996 Natural MicroSystems, Inc. All Rights Reserved.