Difference between revisions of ".wav class"

From Jeskola Buzz Wiki
Jump to: navigation, search
m (Close =)
m (Internal data field)
Line 36: Line 36:
[[Category:Design propositions]]

Latest revision as of 14:59, 11 July 2010

Design proposition of a lean and mean .wav file handler class

General design goals

  • Should not be bloated and support obscure unused features like ADPCM and such. Just PCM.
  • Should be object oriented (C++), so that handling several files is a breeze
  • Should handle both mono and stereo
  • Should handle up to 192 KHz samplerate
  • Should handle the following input formats: 8-bit int, 16-bit int, 24-bit int, 32-bit float
  • Should handle the following output formats: 16-bit int, 24-bit int (optionally 8-bit int and 32-bit float)
  • Remember to use unsigned int for file sizes. No reason to limit ourselves at 2GB when 4GB is the actual limit.


  • Should it support files larger than 4 GB? How does this even work?
  • What should happen to unknown chunks such as markers, weird beat info. It would be super nice to be able to maintain these, but this would take memory.
  • Maybe it should handle IFF AIFF files (as they are 95% identical to .wav it should be fairly simple)



Opens the file and reads meta data (samplerate etc.) into the class, so that various parameters can be known up front.

ReadData(chunksize, convert_to_float)

Reads in chunk size of data (streaming)


Streams in a block of data from the file

Save(output file bitdepth)

Opens up output file, allocated space for headers


Write out a chunk of data


Udpates header information (such as file length) and closes file

Internal data field

  • Length (in samples)
  • Samplerate
  • Channels
  • Bits per sample