Converting a 32 bit wave form to a 16 bit wave form

Sep 28, 2010 at 12:19 AM

I've been capturing audio using the loopback capture mode (found here).  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).

 

Please help

Coordinator
Sep 29, 2010 at 3:18 PM

what is the WaveFormat then? 32 bit int? You might need to make your own custom converter.

 

Nov 23, 2010 at 7:20 PM

FWIW, there is a new version of lame that you can use to convert wav files captured from loopback mode.  You can download it here: http://www.rarewares.org/mp3-lame-bundle.php

Look at the build labeled

LAME 3.98.4 modified to add float wav input

It has been working great for me.  I record the wav files with naudio and then convert them through the command line using this new version of lame.exe

Mar 16, 2011 at 9:28 PM

Pokeyzoe, I'm having the same problem.

I downloaded this lame version you hinted, but using only the command line "lame file.wav file16.wav" is resulting in a mute file16.wav.

Do you have any clue of the right command line arguments? There is a really big list and I am not sure if I understand many of the options.

Thank you!

pokeyzoe wrote:

FWIW, there is a new version of lame that you can use to convert wav files captured from loopback mode.  You can download it here: http://www.rarewares.org/mp3-lame-bundle.php

Look at the build labeled

LAME 3.98.4 modified to add float wav input

It has been working great for me.  I record the wav files with naudio and then convert them through the command line using this new version of lame.exe