[Speex-dev] frame_size parameter

Daniel danflu at uninet.com.br
Tue Mar 10 17:40:36 PDT 2009


Hi Jean,

Thank you for your reply.

Ok... I'm gonna use 'samples per channel' everywhere I see 'samples'... 
but what about  the 'speex_echo_playback' function ?

it does the following loop:

...
for (i=0;i<st->frame_size;i++)
    st->play_buf[st->play_buf_pos+i] = play[i];
...

So... if frame size is 'samples per channel' it will copy only half the play buffer since there are two channels interleaved (supposing the play buffer is stereo of course)

I think it should take into account the number of channels, resulting in something like:

...
for (i=0;i<st->frame_size * play_channels;i++)
    st->play_buf[st->play_buf_pos+i] = play[i];
...


Sorry if what I said doesn't make any sense... I'm just trying to understand how could it work on more than one channel.
Am I missing something ? 

Thank you!
Daniel





Jean-Marc Valin escreveu:
> In stereo mode, you need to use the init_mc() call and consider the
> number of samples *per channel*. Also, more than 20 ms frames are a bad
> idea.
>
> 	Jean-Marc
>
> danflu at uninet.com.br a écrit :
>   
>> Hi,
>>
>> I'm using the echo cancellation api and I would like to
>> clarify the 'frame_size' parameter used in
>> speex_echo_state_init(frame_size,filter_length).
>>
>>
>> In the 'docs' it says:
>>
>> "...where frame_size is the amount of data (in samples)you
>> want to process at once..."
>>
>> So... here are my questions:
>>
>> if I use stereo input/output do I have to put the samples
>> doubled ?
>> For example... if I'm using 100 ms on mono 8khz I just pass
>> 800 as 'frame_size', but if I switch on using stereo will I
>> have to put 1600 samples to represent the same 100 ms? I'm
>> looking at the code of 'speex_echo_playback' and I see the
>> following snippet:
>>
>> ...
>> for (i=0;i<st->frame_size;i++)
>>     st->play_buf[st->play_buf_pos+i] = play[i];
>> ...
>>
>> So... if my buffer is stereo and I put 800 samples as
>> 'frame_size' the previous loop will just copy half of the
>> 'play' buffer data (50 ms) or am I missing something ?
>>
>> Thanks in advance,
>> Daniel
>>
>>
>>
>>
>> _______________________________________________
>> Speex-dev mailing list
>> Speex-dev at xiph.org
>> http://lists.xiph.org/mailman/listinfo/speex-dev
>>
>>
>>     
>
>
>   



Jean-Marc Valin escreveu:
> In stereo mode, you need to use the init_mc() call and consider the
> number of samples *per channel*. Also, more than 20 ms frames are a bad
> idea.
>
> 	Jean-Marc
>
> danflu at uninet.com.br a écrit :
>   
>> Hi,
>>
>> I'm using the echo cancellation api and I would like to
>> clarify the 'frame_size' parameter used in
>> speex_echo_state_init(frame_size,filter_length).
>>
>>
>> In the 'docs' it says:
>>
>> "...where frame_size is the amount of data (in samples)you
>> want to process at once..."
>>
>> So... here are my questions:
>>
>> if I use stereo input/output do I have to put the samples
>> doubled ?
>> For example... if I'm using 100 ms on mono 8khz I just pass
>> 800 as 'frame_size', but if I switch on using stereo will I
>> have to put 1600 samples to represent the same 100 ms? I'm
>> looking at the code of 'speex_echo_playback' and I see the
>> following snippet:
>>
>> ...
>> for (i=0;i<st->frame_size;i++)
>>     st->play_buf[st->play_buf_pos+i] = play[i];
>> ...
>>
>> So... if my buffer is stereo and I put 800 samples as
>> 'frame_size' the previous loop will just copy half of the
>> 'play' buffer data (50 ms) or am I missing something ?
>>
>> Thanks in advance,
>> Daniel
>>
>>
>>
>>
>> _______________________________________________
>> Speex-dev mailing list
>> Speex-dev at xiph.org
>> http://lists.xiph.org/mailman/listinfo/speex-dev
>>
>>
>>     
>
>
>   



More information about the Speex-dev mailing list