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

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


Hi,
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
voices.
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
playback.

I noticed that the example encoder code calls:

speex_bits_init(&bits);

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
compression.

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.)

Peter


More information about the Speex-dev mailing list