[Speex-dev] Optimal frame size to use for file compression?

Peter Gien peterg at podglo.com
Sat Sep 9 13:15:24 PDT 2006

I have raw PCM data that is 180 seconds long and sampled at 22050
samples per second. The data is 16-bit speech audio, male and female
My question is: What is a good frame size to use if I capture the
entire audio stream first and then want to compress it  for later

I noticed that the example encoder code calls:


and I notice that this has the following memory allocation:

bits->bytes = (char*)speex_alloc(MAX_BYTES_PER_FRAME);
bits->buf_size = MAX_BYTES_PER_FRAME;

Somewhere else I noticed that MAX_BYTES_PER_FRAME is #defined to be 2000.

So I think the maximum practical value for a frame size is around 1000
samples although we could go higher if we could predict the

So what is a good practical value for FRAME_SIZE with my application
parameters? I need good compression and good performance. SInce these
are usually opposing goals, I'll settle for something in the middle

Thanks in advance. (BTW, Speex is a gem.)


More information about the Speex-dev mailing list