# Record and play functions

The ADI service provides functions for recording and playing speech data.

## Initiating record and play operations

Choose a set of functions to initiate record and play operations as appropriate to your application's data transfer method, according to the following table:

Operation | Memory transaction | Asynchronous | Callback
--- | --- | --- | ---
Play | adiPlayFromMemory | adiPlayAsync | adiStartPlaying
Record | adiRecordToMemory | adiRecordAsync | adiStartRecording

## Terminating record and play operations

The ADI service provides the following functions to stop record and play regardless of the data transfer method:

Function | Synchronous/ Asynchronous | Description
--- | --- | ---
adiStopPlaying | Asynchronous | Terminates playing.
adiStopRecording | Asynchronous | Terminates recording.

## Using buffer management functions

For the asynchronous data transfer methods, a buffer is submitted using one of the following functions:

Function | Synchronous/ Asynchronous | Description
--- | --- | ---
adiSubmitPlayBuffer | Asynchronous | Supplies a buffer to an asynchronous play operation.
adiSubmitRecordBuffer | Asynchronous | Supplies a buffer for an asynchronous record operation.

## Using status and modification functions

The following functions provide status information or modify an active record or play operation:

Function | Synchronous/ Asynchronous | Description
--- | --- | ---
adiModifyPlayGain | Synchronous | Changes the gain applied to the speech while playing.
adiModifyPlaySpeed | Synchronous | Changes the play speed while playing.
adiGetPlayStatus | Synchronous | Retrieves play (or last play) status.
adiGetRecordStatus | Synchronous | Retrieves record (or last record) status.
adiGetEncodingInfo | Synchronous | Returns frame size, data rate, and maximum buffer size for a given encoding format.
adiCommandRecord | Asynchronous | Sends a data array containing raw commands to an actively running recording function. Use this function to enable voice activity detection.