[Speex-dev] Speex Resampler

John Ridges jridges at masque.com
Thu Jul 15 13:03:40 PDT 2010


First of all,

bufout_len = 320

is correct since that value is the number of stereo samples. Using 640 
would be wrong (and no wonder that it crashes). Secondly, 
"speex_resampler_process_interleaved_float" has a bug that keeps it from 
working when it is output limited, so if you ever set "buf_len" to any  
value greater than 1764 the resampler will stop functioning properly 
from then on. Hope this helps.

--John

Date: Thu, 15 Jul 2010 13:15:32 +0200
> From: Ren? Sch?mann<white06tiger at gmx.de>
> Subject: [Speex-dev] Speex Resampler
> To: Speex-dev at xiph.org
> Message-ID:<4C3EEDD4.4010909 at gmx.de>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Hello,
>
> my problem is a bit identical to Devi's except that i try to use Speex's
> Resampler from SpeexDSP and not "Echo Cancellation" but it won't work too :P
> I was happy as i heard that Speex includes one, because my Programm or
> better dll i want to build needs to be closed source and so other SRC's
> like the one from Secret Rabbit isn't a choice. It must be LGPL or else.
>
> But i can't get Speex resampler to work, it just don't gives any error
> and does like it finished as I've expected but the converted Samples are
> only in the middle part of the buffer changed. all other one is the same...
> This is my code i tried:
>
>      SpeexResamplerState *mspeex_src_state;
>      float buf[3528]; //gets my float samples from bass
>      float bufout[640]; //speex resample out buffer
>      spx_uint32_t buf_len = 0; //set later by bass
>      spx_uint32_t bufout_len = 320; //when i use 640 which is correct, the program crashes.
>      int speex_err = 0;
>
>      mspeex_src_state = speex_resampler_init(2,44100,8000,4,&speex_err);
>      // other code eg. using bass to feed "buf" and set buf_len etc. but this part is correct.
>      speex_err = speex_resampler_process_interleaved_float(mspeex_src_state,buf,&buf_len,bufout,&bufout_len);
>      // speex_err: 0, buf_len: 1764, bufout_len: 320, so resampler does like it worked but it doesn't
>
>
> can someone give me an example code or say what's wrong with mine?
>
> Kind Regards
> White-Tiger (Ren? Sch?mann)
>
> PS: i know my English isn't the best, but you can help me by saying
> what's wrong and i try to fix that ;)
>
>    



More information about the Speex-dev mailing list