[Asterisk-Dev] Re: Handling AST_FORMAT_SLINEAR at 48000Hz

Luigi Rizzo rizzo at icir.org
Thu Nov 17 03:46:59 MST 2005


On Thu, Nov 17, 2005 at 10:28:47AM +0000, Tony Mountifield wrote:
> In article <cb2ad8b50511162204i7fcb9a20g78ef72782e80b26f at mail.gmail.com>,
> Carlos Antunes <cmantunes at gmail.com> wrote:
> > 
> > On 11/17/05, voipwala hindustani <voipwala at gmail.com> wrote:
> > >
> > > But inside asterisk AST_FORMAT_SLINEAR is assumed to be of 8000Hz sampled
> > > voice. But in my case it is 48000Hz sampled.
> > 
> > You need to do a thing called decimation (or downsampling). The easiest way
> > is to make the 48kHz signal go through a first order low-pass filter with
> > cutoff frequency at 4kHz and then collect every 6th sample. You can then
> > assemble the new stream as signed lineat at 8kHz.
> 
> The low-pass filter sounds complicated. How would that compare with, say,
> taking the mean average of every six 48kHz samples to produce one 8kHz
> sample?

it's just not the same thing and will give rise to all sort of
frequency aliasing effects - those that the lowpass filtering is supposed
to remove.
quick example: consider a 9khz signal - that is clearly not audible
on a 4KHz channel (8000 hz sampling rate). Yet if you sample it at
48khz and take the average of every 6 samples, these averages will not
be constant (because the 9khz signal does not have a period of 6 samples)
and so you'll get an output signal that will appear as 1KHz.
This is the aliasing effect.

cheers
luigi



More information about the asterisk-dev mailing list