Re: LPCM Downmix Algorithm problem
Re: LPCM Downmix Algorithm problem
- Subject: Re: LPCM Downmix Algorithm problem
- From: Admiral Quality <email@hidden>
- Date: Sun, 15 Aug 2010 00:34:36 -0400
On Sun, Aug 15, 2010 at 12:31 AM, Sean Costello <email@hidden> wrote:
>
> On Aug 14, 2010, at 9:01 PM, Ryan Walklin wrote:
>
>
> So I tried, in an attempt to "re-scale" the resultant sum back into the
> 16-bit domain:
>
> Mixed-Sample = (Sample1 + Sample2) / 2
>
> But this doesn't work either.
>
> In what way won't it work? This logic seems sound if the sample rates match.
> You're reducing the volume of both signals to 50% so that there won't be
> clipping.
>
> In a fixed point system, the order that operations are performed is
> important. The code above adds the samples together first, then reduces the
> volume. If the sum of the signals clips or wraps around, the /2 operation
> will just reduce the volume of the clipped / wrapped waveform, with clipping
> / wrapping intact.
> To avoid clipping while staying in 16 bits, you want to scale down first,
> sum second.
> Sean Costello
Actually you should sum at a higher bit depth, then do the scale.
Scaling first requires twice as many divisions, and you also
accumulate more error that way.
Mixed-Sample = ((int)Sample1 + Sample2) / 2
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden