ADPCM(2)

NAME
adpcm - Adaptive delta compression for audio samples #include "adpcm.h"
adpcm_coder(short inbuf[], char outbuf[], int nsample,
    struct adpcm_state *state);
adpcm_decoder(char inbuf[], short outbuf[], int nsample,
    struct adpcm_state *state);

DESCRIPTION
These routine convert 16 bit linear PCM samples to 4 bit ADPCM code and vice versa. The ADPCM code used is the Intel/DVI ADPCM code which is being recommended by the IMA Digital Audio Technical Working Group.

Adpcm_coder converts nsample 16 bit samples from inbuf and stores the 4 bit codes, packed two per byte, in outbuf. State points to a structure containing the coder state information, a short and a char. It should be initialized to zero before the first call. The coder updates the state record, and it should be passed to each subsequent call.

Adpcm_decoder converts nsample 4 bit codes from inbuf to 16 bit samples and stores these in outbuf. State is a state record similar to that used by the coder.

If you compress audio to transmit it across a lossy network it is a good idea to send the compressor state along with each packet. (This must be the state as it was before the call to adpcm_coder, not the state after the return). This state record can then be fed to the decompressor. This way the decompressor can tolerate packet loss.

NOTES
The routines have not been tested against an official Intel/DVI coder yet, so incompatabilities might exist.
The state record is not byte-order-independent. Remember this when transmitting it across the network.

SEE ALSO
Proposal for Standardized Audio Interchange Formats, IMA compatability project proceedings, Vol 2, Issue 2, May 1992.

AUTHOR
Jack Jansen, CWI, Amsterdam
Jack.Jansen@cwi.nl