The original WAV player could only play one type of WAV file; 8180Hz, 8 bit, mono, uncompressed
My WAV player can play 4 more sample rates
However, now that PCMSTREAM exists, there are even more options, and we need a way to tell the sample rate, sample size, etc. of WAV files.
I think that the first element of the DAT file should contain information, like this:
[0] RRRRRRRRRRRRRRRRRRZSC???????????
|________________/|_/|_________/
rate flags unused
(each letter represents 1 bit)
- R is the sample rate, which is allowed to be from 1 to 192000 samples per second (requires 18 bits to store)
- Z is the sample size. 0=8bit, 1=16bit. The old WAV players used 8 bit samples, but PCMSTREAM only supports 16 bit unsigned. You can convert 8 to 16 bit unsigned using ARYOP though.
- S: 0=mono, 1=stereo (PCMSTREAM supports stereo WAVs.)*
- C is the compression. 0=uncompressed, 1=compressed. (compressed files just store multiple samples in a single array element) 8 bit mono compressed: [ 11111111 22222222 33333333 44444444 ] 8 bit stereo compressed: [ LLLLLLLL RRRRRRRR LLLLLLLL RRRRRRRR ] 16 bit mono compressed: [ 1111111111111111 2222222222222222 ] 16 bit stereo compressed: [ LLLLLLLLLLLLLLLL RRRRRRRRRRRRRRRR ] (worsens loading time but not quality)