Voicetronix Programming Guide
<<< Previous |  | Next >>>

# Playing and Recording Audio

## Summary of Play Functions

The API play functions are listed below:

`vpb_play_file_sync()`
`vpb_play_file_async()`
`vpb_play_voxfile_sync()`
`vpb_play_voxfile_async()`
`vpb_play_terminate()`
`vpb_play_buf_start()`
`vpb_play_buf_sync()`
`vpb_play_buf_finish()`
`vpb_play_set()`
`vpb_play_set_gain()`
`vpb_play_get_gain()`

The VPBAPI supports the playing of WAVE and VOX and AU files. It also accommodates the playing of buffers from memory via the user defined play routines. The play functions can be configured to terminate when a DTMF digit is received using `vpb_play_set()`. The play functions may be prematurely stopped using `vpb_play_terminate()`. The API provides a function to alter the VPB audio out levels within the range of -12 to 12 dB (0.1dB resolution). This is accomplished by `vpb_play_set_gain()`.

## Summary of Record Functions

The API record functions are listed below:

`vpb_record_file_sync()`
`vpb_record_file_async()`
`vpb_record_voxfile_sync()`
`vpb_record_voxfile_async()`
`vpb_record_terminate()`
`vpb_record_buf_start()`
`vpb_record_buf_sync()`
`vpb_record_buf_finish()`
`vpb_record_set()`
`vpb_record_set_gain()`
`vpb_record_get_gain()`

The VPBAPI supports the recording of audio files. It also accommodates the recording of audio to memory via the user defined record routines. The record functions can be configured to terminate when a DTMF digit is received using `vpb_record_set()`. The record functions may be prematurely stopped using `vpb_record_terminate()`. The API provides a function to alter the VPB audio in levels within the range of -12 to 12 dB (0.1dB resolution). This is accomplished by `vpb_record_set_gain()`.

## Playing Audio

The API functions for playing audio are divided into two groups; file-based functions, and buffer-based functions.

The file-based play functions are designed to make playing files straightforward. These functions support WAVE and AU files sampled at 8 ksamples/s only, playing files that follow the WAVE and AU file specification including for 16 bit Linear, 8 bit A-Law, 8 bit Mu-Law, and 4-bit OKI-ADPCM.

`vpb_play_file_sync()`
`vpb_play_file_async()`

There are also file-based play functions that support VOX (headerless) audio files sampled at 8 ksamples/s including; 16 bit Linear, 8 bit A-Law, 8 bit Mu-Law and 4 bit OKI-ADPCM.

`vpb_play_voxfile_sync()`
`vpb_play_voxfile_async()`

The buffer-based play functions allow the development of custom play routines in situations where the file-based functions are inappropriate, for example, when playing buffers from memory or when using non WAVE/VOX file formats:

`vpb_play_buf_start()`
`vpb_play_buf_sync()`
`vpb_play_buf_finish()`

## Compression (encoding) mode used to store samples

Mode | Description
--- | ---
VPB_LINEAR | 128kbit/s, 16 bit linear, 8kHz sampling rate
VPB_ALAW | 64kbit/s, A-Law companded
VPB_MULAW | 64kbit/s, Mu-Law companded
VPB_OKIADPCM | 32kbit/s, Oki-ADPCM, 4 bit, 8kHz sampling rate
VPB_OKIADPCM24 | 24kbit/s, Oki-ADPCM, 4 bit, 6kHz sampling rate

## Recording Audio

The API functions for recording audio are divided into two groups; file-based functions and buffer-based functions.

The file-based record functions are designed to make recording files straightforward. The functions support WAVE files sampled at 8 ksamples/s, recording audio to files that follow the WAVE file layout specification including 16 bit Linear, 8 bit A-Law, 8 bit Mu-Law and 4-bit OKI-ADPCM.

`vpb_record_file_sync()`
`vpb_record_file_async()`

There are also file-based record functions that support VOX audio files sampled at 8 ksamples/s including; 16 bit Linear, 8 bit A-Law, 8 bit Mu-Law and 4 bit OKI-ADPCM.

`vpb_record_voxfile_sync()`
`vpb_record_voxfile_async()`

The user definedbuffer-based record functions allow the development of custom record routines in situations where the utility functions are inappropriate, for example, when recording buffers to memory or when using non WAVE/VOX file formats:

`vpb_record_buf_start()`
`vpb_record_buf_sync()`
`vpb_record_buf_finish()`

<<< Previous | Home | Next >>>
Events |  | DTMF and Programmable Tone Generation