I had one hell of a time finding a clear document on how to write the header
of a basic PCM wav file.  This is what i've found out mostly by reading docs
and a little by exploratory surgery.  If ever you find any of this to be 
incorrect, please let me know via email at tannoy@wep.net.


Basic structure of a simple PCM wav header.
struct{
	char	RiffTag[3]; 	// 'RIFF'
	long	FileLength;
	char	FormatTag[6];	// 'WAVEfmt'
	long	FormatLength;	// 16
	short	DataFormat;
	short	NumChannels;
	long	SampleRate;
	long	BytesPerSecond;
	short	BlockAlignment;
	short	SampleDepth;
	char	DataTag[3];	// 'data'
	long	DataLength;
} WavHeader;

FileLength:
	The length of the rest of the file from this point;  It comes out to
	being DataLength(bytes) + 32(rest of header).
	
DataFormat:
	The format of the sample data; PCM audio is registered as 1 for this
	paramater. You can pretty much just take it as granted unless you
	are using weirdo sampleing.
	
NumChannels:
	1 or 2; Obviously mono or stereo.  There can be more than 2
	channels, but i cant see where that would be applied.

SampleRate:
	Number of samples per second;
	
BytesPerSecond:
	Number of bytes processed in one second; This is usefull for
	buffersize estimation.
		SampleRate * (SampleDepth / 8) * NumChannels;
	
BlockAlignment:
	Number of bytes that must be read (or multiple of this) to correctly
	write the sample data to the device.
		(SampleDepth / 8) * NumChannels;
		
SampleDepth:
	Number of bits per sample; Generally will be 8 or 16.
	
DataLength:
	The length of the sampledata in bytes.
		RecordTime(seconds) * (SampleDepth / 8) *
		SampleRate * NumChannels
		
