[Speex-dev] tgAudioCodec.zip
Tom Grandgent
tgrand at canvaslink.com
Tue Apr 26 05:51:51 PDT 2005
I have (finally) posted my Speex wrapper classes. They are at:
http://www.grandgent.com/spx/tgAudioCodec.zip
I followed your recommendations and they worked fine with 1.1.0.
However, I'm still having the same problem with 1.1.7 that I had the
last time I tried to upgrade. I'm using the same code with both versions,
except for calling speex_encode_int instead of speex_encode, and passing
ints to speex_preprocess instead of floats.
What happens is that the encoder gets into a bad state and everything
sounds garbled after that point. I can restart the decoder, disable
the preprocessor, and the problem still exists, so I think the problem
is related to the encoder. This problem might happen 2 minutes into a
stream or an hour, it seems random, but it's happened 3 times in about
2-3 hours of testing, on both a 900MHz Athlon and a 2.8GHz P4.
This time, I've saved the decoder's output. I'm hoping that if you
listen to it, you might have some idea of the problem. It sounds like
the low half of the frequency spectrum is somewhat ok, but the high half
is totally messed up, getting 'frozen' on these weird sounds. (I'm using
wideband 16kHz only. VBR quality 6, not using Speex's VAD or DTX.)
You can hear the audio go from good to bad at 9 seconds into this clip.
At 32 seconds, I turn off the preprocessor and you can hear the weird
sounds still occurring. Note that the loud noise is the background noise
always present on that PC. The Speex denoiser does an amazing job. :)
I've made the audio clip available as WAV (1.4MB), OGG (211KB),
and SPX (75KB). They all sound pretty much the same:
http://www.grandgent.com/spx/badenc.wav
http://www.grandgent.com/spx/badenc.ogg
http://www.grandgent.com/spx/badenc.spx
Any ideas would be greatly appreciated...
Tom
Jean-Marc Valin <Jean-Marc.Valin at USherbrooke.ca> wrote:
>
> > Glad to hear there is a way now. The problem I ran into predated that
> > feature though. At some point, speex_preprocess got changed from
> > taking floats to ints. Not a big deal for me, and I know it's part of
> > the unstable series, but it was a breaking change that I never knew
> > about until someone got compile errors with my class.
>
> Yeah, I prefered to change it now, so that if the preprocessor is ever
> converted to fixed-point I won't have to change it again or have two
> versions of the functions like for encoding and decoding (float and
> _int() version).
>
> > I had tried to upgrade to a newer version of Speex myself, but I kept
> > getting weird problems where the decoder would flip out after awhile
> > (seemingly at random, and almost never on my PC), producing very loud
> > noise, and I'd have to restart the stream. After some unsuccessful
> > debugging attempts I went back to the older version that has been very
> > solid for me. I'm pretty sure the problem is on my end but I haven't
> > figured it out yet...
>
> Would be nice if you did, just in case it's a problem with Speex.
> Perhaps just tracking down when it happened could help.
>
> > I thought it might be related to packing multiple frames together. Can
> > you tell me if it's still ok to do speex_bits_init, call speex_encode
> > several times, then speex_bits_insert_terminator, then speex_bits_write +
> > speex_bits_destroy. And then on the decoding side do speex_bits_init,
> > speex_bits_read_from, and loop on speex_decode until either it returns -1
> > or speex_bits_remaining returns <= 0?
>
> Should be OK. Now, even just speex_bits_write() should even insert the
> terminator for you. BTW, no need to init() and destroy(), you can just
> just use reset(). As for speex_bits_remaining, it's not necessary
> either, just the return value of speex_decode should be fine. If not, it
> may be a bug (though I'd be surprised).
>
> > Hmm, you and Ralph have convinced me to put it back online. But I'll
> > have to review the code and strip out the application-specific stuff
> > I've added since then. I suppose if I put a little more thought into
> > the instructions I include with it, things would probably be ok. I
> > think I overreacted before anyway...
>
> Good to hear :-)
>
> Jean-Marc
>
> --
> Jean-Marc Valin <Jean-Marc.Valin at USherbrooke.ca>
> Université de Sherbrooke
More information about the Speex-dev
mailing list