[Asterisk-Dev] Re: Handling AST_FORMAT_SLINEAR at 48000Hz
Kaloyan Kovachev
kkovachev at varna.net
Thu Nov 17 04:15:02 MST 2005
What about using Musinc on hold ?
I've made a test with
musiconhold.conf (on Asterisk 1.0.9 box)
test => custom:/var/lib/asterisk/test/,/usr/bin/madplay -i --mono -R 8000
--output=raw:-
and in /var/lib/asterisk/test/ there is a simlink named snd.mp3 to
/dev/urandom :)) (as I get device busy on dsp, but with your 'device hacking
functions' it should work) and it works ... well lots of errors of lost
sincronization and crc errors (without -i switch), but it gives some fun
results. Changing the simplink to your device should give you what you need.
On Thu, 17 Nov 2005 02:46:59 -0800, Luigi Rizzo wrote
> 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
> _______________________________________________
> Asterisk-Dev mailing list
> Asterisk-Dev at lists.digium.com
> http://lists.digium.com/mailman/listinfo/asterisk-dev
> To UNSUBSCRIBE or update options visit:
> http://lists.digium.com/mailman/listinfo/asterisk-dev
More information about the asterisk-dev
mailing list