Does anyone know how music is stored on a CD [i.e. as a WAV file]. Does it use positive / negative values or does it use positive / two's-complement ?
Some info ..
http://www.delback.co.uk/pcaudiofaq.htm#wavfmt
".....
What's the format of a WAV file?
A WAV file is a particular type of RIFF file. The possible formats for RIFF files are quite extensive, but here I will describe a straightforward WAV file, which is a RIFF file containing just one WAV data chunk.
Header in C-speak:
struct WAV_format
{
char riff[4]; /* the characters "RIFF" */
unsigned long file_length; /* file length - 8 */
char wave[8]; /* the characters "WAVEfmt " */
unsigned long offset; /* position of "data"-20 (usually 16) */
unsigned short format; /* 1 = PCM */
unsigned short nchans; /* #channels (eg. 2=stereo) */
unsigned long sampsec; /* #samples/sec (eg. 44100 for CD rate) */
unsigned long bytesec; /* #bytes/sec (see note 1) */
unsigned short bytesamp; /* #bytes/sample (see note 1) */
unsigned short bitsamp; /* #bits/sample (see note 1) */
char otherstuff[N]; /* N = offset-16 (see note 5) */
char dataheader[4]; /* the characters "data" */
unsigned long datalen; /* #bytes of actual data */
};
Immediately following this header are the actual bytes of data, interleaved by channel. For example, in a 4-channel 16-bit WAV file, the first two bytes are the first sample of channel 1, the next two bytes are the first sample of channel 2, the next two are sample 1 of channel 3, then sample 1 of channel 4, then back to channel 1, etc.
Notes:
#bytes/sec should be set to the number of bytes for all channels (eg. for stereo 16-bit 44.1kHz, this should 176400); #bytes/samples should also be set for all channels (eg. for stereo 16-bit, this should be 4, not 2); #bits/samples should be set for a single channel (eg. for stereo 16-bit, this should be 16, not 32).
WAV format requires the samples to be stored as Intel format integers (ie. least significant byte first) rather than, for example, Sparc format (most significant byte first).
For stereo data, channel 1 is left, channel 2 is right. I don't know the assignment for multi-channel (or even if there is a standard).
Following the actual WAV data, extra descriptive text may be present, which should not be processed as audio data; applications may put in stuff for their own purposes at the end (eg. copyright notices).
"otherstuff" is extra header data that may be present in WAV files written by some utilities. Most utilities do not write anything here (so N=0), but be aware that it might be present.
....."
This does not say anything about two's-complement.
james