www.pudn.com > speakfs.zip > ADPCM.2, change:1998-10-14,size:1914b

.TH ADPCM 2 "7 June 1992" 
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); 
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. 
\fIAdpcm_coder\fP converts \fInsample\fP 16 bit samples from 
\fIinbuf\fP and stores the 4 bit codes, packed two per byte, in 
\fIoutbuf\fP. \fIState\fP 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. 
\fIAdpcm_decoder\fP converts \fInsample\fP 4 bit codes from 
\fIinbuf\fP to 16 bit samples and stores these in \fPoutbuf\fP. 
\fIState\fP 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 \fIbefore\fP the call to 
\fIadpcm_coder\fP, not the state after the return). This state record 
can then be fed to the decompressor. This way the decompressor can 
tolerate packet loss. 
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. 
Proposal for Standardized Audio Interchange Formats, IMA compatability 
project proceedings, Vol 2, Issue 2, May 1992. 
Jack Jansen, CWI, Amsterdam