[Speex-dev] Symbian and buffer of 4096 bytes

Jean-Marc Valin jean-marc.valin at usherbrooke.ca
Fri Apr 13 19:08:12 PDT 2007


Maurizio Cembalo wrote:
> I'm using speex under symbian (8000 hz, 16 bit) narrow band.
> The phones API only give me a buffer of 4096 bytes in recording.To
> reproduce audio I must fill up the buffer of the same dimension. 4096
> isn't a multiple of 320.

What you get is rarely a multiple of 20 ms, that's what buffering is for.

> I want encode the audio in streaming.
> 
> The solution that I adopt to encode is:
> - Divide 4096-256 bytes in 12 frames of 320 bytes.
> - Therefore the frame number 13 is composed only of 256 bytes.
> 
> I encode every frame and I fill up the last frame (13th) with 0 to
> reach 160 samples.

Ouch! I've seen creative ways of screwing up the encoding, but this is a
new one :-) No, it doesn't work! If you don't have enough samples to
fill up a frame, just keep them for the next time.

That being said, encoding 2048 samples (4096 bytes) at a time seems like
a horrible thing to do for VoIP because it will add insane amounts of
latency. It's recommended to capture audio smaller bits at a time.

> I'm not sure, but it seems a low degradation but wish to know if it is
> due to Speex or to the phone...

Definitely the phone!

> i'd like to know if the zeroes-padding i use could affect the encoder
> in term of audio quality and, most of all, performance.

I affects quality, badly. Please fix that :-)

	Jean-Marc


More information about the Speex-dev mailing list