[Speex-dev] Encoding a wave file with a bad header

Clifton Craig clifton.craig at gmail.com
Thu May 6 09:24:45 PDT 2010

I gotta stop sending dumb/desperate cries for help to this list... for what it's worth I figured out my hangup. I was hard coding a mode in the decompression side. Had nothing to do with corrupt wav headers...

On May 6, 2010, at 10:08 AM, Clifton Craig wrote:

> If I use Speex, JSpeex actually, to compress an otherwise valid wave file with zero lengths in the header would it impact the compression at all? Here's what I'm doing during compression in Java:
>        AudioFormat wavFormat = ais.getFormat();
>        AudioFormat speexFormat =
>            new AudioFormat(SpeexEncoding.SPEEX_Q5,
>                        wavFormat.getSampleRate(),
>                        -1, // sample size in bits
>                        wavFormat.getChannels(),
>                        -1, // frame size
>                        -1, // frame rate
>                        false); // little endian
>        AudioInputStream spx = AudioSystem.getAudioInputStream(speexFormat, ais);
>        AudioSystem.write(spx, SpeexFileFormatType.SPEEX, getOutputStream());
> I then use speex C library to decompress on the receiving end. In one case where audio comes from a certain source (headers are properly formed) the compression/decompression works but in another case where wave audio comes from a different source (different sample rate and zeroes in the size fields) I get slowed playback speed. Its as if the sample rate is off or as if the encoding is not seeing the proper size of the samples. The second case with the corrupt headers uses 16 bit sample size for PCM linear wave.
> Clifton Craig
> Software Engineer
> http://codeforfun.wordpress.com
> clifton.craig at gmail.com

More information about the Speex-dev mailing list