[asterisk-dev] downsampling slinear16 to ulaw (or alaw or g729)

Paul Albrecht albrecht at glccom.com
Mon Aug 30 15:14:21 CDT 2010


On Mon, 2010-08-30 at 15:01 -0500, Kevin P. Fleming wrote:
> On 08/30/2010 02:51 PM, Paul Albrecht wrote:
> > On Mon, 2010-08-30 at 14:39 -0500, Kevin P. Fleming wrote:
> >> On 08/30/2010 02:29 PM, Paul Albrecht wrote:
> >>> On Mon, 2010-08-30 at 14:15 -0500, Kevin P. Fleming wrote:
> >>>> On 08/30/2010 01:48 PM, Paul Albrecht wrote:
> >>>>
> >>>>> As for AST_FORMAT_SLINEAR16 to AST_FORMAT_SLINEAR translation, I get
> >>>>> truncation, that is, instead of the 160 samples I was expecting I get
> >>>>> 137 samples. I guess I don't know how to interpret these results, if
> >>>>> slinear16/slinear results in truncation that's a bug, right?
> >>>>
> >>>> Yes. That particular transcoding step is just resampling, and it should
> >>>> produce exactly half as many samples as were input (unless an odd number
> >>>> were input, of course).
> >>>>
> >>>>> One more thing to mention, I have translated my silent frame to some
> >>>>> other codecs from wide slinear without truncation. They are gsm, speex,
> >>>>> and g722. Of course g722 is wide so that's not surprising, but I don't
> >>>>> think gsm is wide and it is not truncated.
> >>>>
> >>>> That's somewhat illogical; all paths to 8Khz codecs should go through
> >>>> the same resampling step first, then into the codec. If there are
> >>>> samples being dropped during resampling, it should occur for all of them.
> >>>>
> >>>
> >>> I don't know what's causing the problem, but the translated gsm and
> >>> speex frames claim 160 samples which is what what I got when I used
> >>> AST_FORMAT_SLINEAR. The g729 was truncated in half, that is, only 80
> >>> samples, which is much worse than ulaw/alaw truncation.
> >>
> >> What audio are you feeding in to these translators? It is sampled audio,
> >> all zeroes, all ones, something else?
> >>
> > 
> > I'm sending one slinear frame to the translator, and all the frame
> > samples are zero. 
> 
> Then I have no other ideas... something is terribly wrong, but it can't
> be happening to everyone, because lots of people are using mixed
> wideband/narrowband calls.
> 

Fortunately, it's not difficult to replicate the problem. Simply craft a
linear frame with all the samples set to zero, send it through the
translator, then verify the result. Beyond that, I don't have any
insight into what's causing the problem.

> -- 
> Kevin P. Fleming
> Digium, Inc. | Director of Software Technologies
> 445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
> skype: kpfleming | jabber: kfleming at digium.com
> Check us out at www.digium.com & www.asterisk.org
> 
-- 
Paul Albrecht




More information about the asterisk-dev mailing list