[Speex-dev] Size of each block in a circular buffer and the sample rate

Kevin Jenkins gameprogrammer at rakkar.org
Sat May 20 15:46:55 PDT 2006


Thanks!  I hope this isn't a stupid question but if I want to play two 
or more voices at the same time, I just add the values of the samples 
right?  If I'm using an unsigned short, should I then clamp the values 
to 65535?

Jean-Marc Valin wrote:
>> Is frameSize in bytes?  If not, what unit is it in?  I need to know so I 
>> know how big to make each element in my circular buffer.
> 
> It's in samples, regardless of whether you use floats or shorts.
> 
>> Also, do I need to call
>>
>> speex_encoder_ctl( enc_state, SPEEX_SET_SAMPLING_RATE, &sampleRate );
>>
>> Depending on sample rate I record my audio in?  If not, is there any 
>> benefit to setting the sample rate, such as reduced bandwidth?
> 
> The only thing Speex does with the sampling rate is compute the final
> bit-rate it corresponds to. If you use a "nominal" bit-rate (8 kHz for
> narrowband, 16 kHz for wideband, ...), which I strongly recommend, you
> don't even need to call this.
> 
> 	Jean-Marc
> 
> 


More information about the Speex-dev mailing list