(Page 3 of 8 in this chapter)


6.2 Voice Encoding Formats

When recording or playing voice files, the application must select an encoding format. The primary issue to consider when selecting a format is the compression ratio versus the fidelity. More aggressive compression requires less disk space and reduces host-to-AG loading.

AG boards support the following encoding formats:

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

The encodings refer to the data going to and from the host, typically stored in a voice file. 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. The exception to this is ADI_ENCODE_NMS_64, in which the encoding is derived from the line encoding.

The encoding formats are:

Encoding Format

Description

Sample Size
(bits)

Sample
Rate (Hz)

Frame
Size
(Bytes)

Frame
Time
(ms)

Data Rate
(Bytes/sec)

ADI_ENCODE_NMS_16

NMS ADPCM
16 kbit/s

2

8000

42

20

2100

ADI_ENCODE_NMS_24

NMS ADPCM
24 kbit/s

3

8000

62

20

3100

ADI_ENCODE_NMS_32

NMS ADPCM
32 kbit/s

4

8000

82

20

4100

ADI_ENCODE_NMS_64

framed PCM
64 kbit/s

8

8000

162

20

8100

ADI_ENCODE_MULAW

mu-law 64 kbit/s

8

8000

80

10

8000

ADI_ENCODE_ALAW

A-law 64 kbit/s

8

8000

80

10

8000

ADI_ENCODE_PCM8M16

PCM 8k mono
16-bit (WAVE format)

16

8000

160

10

16000

ADI_ENCODE_OKI_24

OKI ADPCM
24 kbit/s

4

6000

30

10

3000

ADI_ENCODE_OKI_32

OKI ADPCM
32 kbit/s

4

8000

40

10

4000

ADI_ENCODE_PCM11M8

PCM 11kHz 8 bit mono (WAVE format)

8

11000

110

10

11000

ADI_ENCODE_PCM11M16

PCM 11 kHz
16- bit mono (WAVE format)

16

11000

220

10

22000

ADI_ENCODE_G726

G.726 ADPCM
32 kbit/s

4

8000

40

10

4000

6.2.1 Buffer Sizes

All buffers submitted to AG Access for play operations must be able to contain an integral number of frames for the selected encoding format. For example, if you select ADI_ENCODE_NMS_24, the buffer size must be a multiple of 62 bytes. Failure to submit a buffer meeting this size requirement for a play operation causes the function to terminate with a CTAERR_BAD_SIZE reason. Other than the multiple frame size requirement, buffers submitted to AG Access can be any 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.

AG Access employs a double-buffering scheme when recording and playing voice files. This means that when the AG board finishes processing a buffer, the subsequent buffer must already be allocated and submitted to AG Access by the application.

6.2.2 Underruns

Underruns are manifested as gaps in the voice data. On heavily loaded systems, the throughput requirements between the host and the AG board may cause gaps in the voice record or playback. Failure to maintain pace with the AG board can also cause underruns in the record or playback operation. Greater file compression may be necessary to eliminate the problem.

AG Access counts the number of underruns that occur, but not their duration. Retrieve the underrun count by calling adiGetRecordStatus and adiGetPlayStatus.

Note: It is important not to submit small buffers (e.g., buffers that hold less than one second of data) because small buffers can also cause underruns. The data throughput for a given encoding method can be derived from the values returned by adiGetEncodingInfo.



(Page 3 of 8 in this chapter)


tech_support@nmss.com
Copyright © 1997, Natural MicroSystems, Inc. All rights reserved.