Compressing/Decompressing an Audio Stream

Point taken.

I’ve actually implemented the previous methods discussed here now but as you mention using a specialised codec is probably a much better idea. For posterity here are the compression ratios that resulted:

GZip on float samples: 0.92
Convert to int16: 0.5 (obviously)
Convert to int16 then GZip: 0.48
Convert to int16 differentiate then Gzip: 0.4

An initial test with Ogg at 128kb gives a ratio of 0.35. This will be much easier to control for the user as they can simply select a bit rate by a slider.

Which brings me onto another question (maybe I should start a new thread with this?). Is the built in OggVorbisAudioFormat suitable for compressing blocks of audio? At the moment I’m writing the samples to a memory block with a stream which seems to work ok but when I decompress them (using OggVorbisAudioFormat::createReaderFor()) the program just hangs in readSamples. It seems that the numAvailable to the OggReader is always 0.

I will look into this further if this method should be possible, just wanted to check that I’m using the OggVorbisAudioFormat in an intend manner before spending even more time debugging it. Any pointers welcome.