[Speex-dev] frame size in speex

Jean-Marc Valin jean-marc.valin at usherbrooke.ca
Wed May 6 04:30:39 PDT 2009

akhalife at uci.edu a écrit :
> Dear Speexers :-)
> I am trying to change the frame size from 20 ms to 10 ms, I did that by
> changing the value of the frame_size from 160 samples, to 80 samples in
> the sampleenc.c file. The number of frames increased as expected, but the
> size of the encoded stream of each frame remain the same! For example, if
> I use quality mode # 8 (corresponds to 15 kbps), the encoded streams size
> in bytes equals to 38 bytes per frame( 15*1024*.02/8=38 bytes). Now, if I
> made the frame size =80 samples (10 ms), I was expecting the frame size in
> bytes to be equal to 19 bytes, but I was getting 38 bytes too? Any idea?

There's a *lot* of places in the code that assume that frames are 20 ms,
including the LPC analysis window, but other things as well. Unless
you're prepared to spend the time to understand how Speex works to
change that, forget it. Note that even if you succeeded in changing it
to 10 ms, the compressed frames would be more than half the size because
there's per-frame data too (e.g. the LSPs). So if you really need
smaller frames, use another codec. There's CELT
(http://www.celt-codec.org/) which is aimed at higher quality (48 kHz, >
48 kbit/s) or otherwise, I don't know any free speech codec with 10 ms


More information about the Speex-dev mailing list