I've been capturing audio using the loopback capture mode. The captured waveform is a 32 bit waveform. I'm struggling with converting this to a 16 bit waveform so encoders like lame can deal with it (it says Unsupported data format: 0x0003).
I've tried shifting the bits (not my strong point) in the wave stream itself from 32 bit to 16 bit but the result still sounds distorted.
The Wave32To16Stream class seems to blow up on this case: if (sourceStream.WaveFormat.Encoding != WaveFormatEncoding.IeeeFloat) throw new ApplicationException("Only 32 bit Floating point supported");
Ideally I would want to just capture straight to 16 bit, is there no way to set the capture bit depth? If not, could somebody help me with converting the wavestream?
An example of a captured waveform can be found here: http://dl.dropbox.com/u/454409/test.wav (10mb)
I would also settle for some way to encode this to mp3 with lame, I've tried every parameter permutation I can think of to get it to accept the wave file. What's interesting is Audacity (which uses lame_enc to encode mp3s) was able to create an mp3 from the waveform (but maybe Audacity automatically converts it to 16bit before passing it to lame).
Sox can convert this for you.
Suitable commandlines:
sox any-file -b 16 outfile rate -I 22050 dither -s
N.B. Both resampling and dithering require some headroom. If SoX reports that any clipping has occurred during processing then the conversion should be redone with some attenuation, e.g.
sox any-file -b 16 outfile gain -1 rate 44100 dither -s