[Speex-dev] Resample UltraWideBand to NarrowBand

Jean-Marc Valin Jean-Marc.Valin at USherbrooke.ca
Wed Mar 18 08:20:43 PDT 2009

Quoting Jim Crichton <jim.crichton at comcast.net>:

> The resampler will convert raw audio from one sample rate to another.  You
> are starting with Speex-encoded audio frames.  So, what you need to do is:
> 1.  Run the media frames through the Speex decoder (look at Speexdec or
> testenc_uwb).  This will give you raw audio with a 32 KHz sample rate.
> 2.  Use the resampler to convert the audio from 32 KHz to 8 KHz sample rate.
> 3.  Run the 8KHz audio through a G711 encoder.
> For the narrowband case, Asterisk is doing steps 1 and 3.

Alternatively, it's possible to use a narrowband Speex decoder to decode a 32
kHz stream, in which case you'll get the 8 kHz directly.


>   ----- Original Message -----
>   From: Thiago Maluf
>   To: speex-dev at xiph.org
>   Sent: Tuesday, March 17, 2009 4:59 PM
>   Subject: [Speex-dev] Resample UltraWideBand to NarrowBand
>   Hi List,
>   Now I will send to you more specific what I am trying to do.
>   I have one Asterisk Channel where receives Midia Frames in the codecs
> format: Speex UltraWideBand and Speex NarrowBand.
>   When I use Speex NarrowBand the Asterisk is able to convert this frame to
> G711.
>   But when I use Speex UltraWideBand the Asterisk don't convert it.
>   Then I need in my Asterisk Channel Source include the Speex Library in
> resample this frame in 32KHz to 8KHz.
>   Searching for it in Speex Doc, I found it:
>   SpeexResamplerState *resampler;
>   resampler = speex_resampler_init(nb_channels, input_rate, output_rate,
> quality, &err);
>   err = speex_resampler_process_int(resampler, channelID, in, &in_length,
> out, &out_length);
>   But in my source I have one *dataframe where is my payload. How I can use
> it to resample my frame?
>   Thanks you very much, Thiago.
> ------------------------------------------------------------------------------
>   _______________________________________________
>   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