LoginLogin

WAV file information

Root / General / [.]

12Me21Created:
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)
* since 2D DAT files are near impossible to work with, stereo WAVs will be stored (for now) in one of 2 formats: 1: uncompressed: the first half of the DAT file holds the left channel, the second half holds the right 2: compressed: (see the compression diagrams above) Conflicts with old stuff: Old WAV players will interpret this data element as an audio sample, but it most likely won't be noticeable. of course, they also won't be able to play the compressed files, or files with larger sample size, nonstandard sample rate, etc. However, there is currently no way for new WAV players to tell if the first element is in this format or not. Therefore, I suggest including an option on new WAV players, allowing the user to disable automatic rate,sample size, etc. detection. If anyone has any suggestions, post them here (of course)