Sign in

username:

password:



Not a member?

Search audiodsp



Search tips

Subscribe to audiodsp



audiodsp by Keywords

AAC | ADPCM | Convolution | DAFx | FFT | IIR | Mixer | MP3 | MPEG | MPEG-4

Ads

Discussion Groups

Discussion Groups | Audio Signal Processing | Mixing down from multiple input sources

Technical discussions related to Audio Signal Processing (digital effects, acoustics, noise reduction, musical signal processing, etc).

  

Post a new Thread

Mixing down from multiple input sources - "d.abc51" - Jul 13 22:10:26 2008



Hi all, I'm trying to code a program that can mix together multiple
PCM wav files into a single output. It is essentially a sequencer, and
works fine at points in the sequence where only one or two sounds are
playing, however any more than that and the distortion can become
unbearable.

All I am doing right now is adding the sample values for each channel
together and taking the sum of these as my output. However all too
often this value will be beyond the range of a 16 bit samplerate,
which results in clipping and distortion.

I have tried dividing by the number of input streams at any given time
but while it eliminates distortion, this can make the output too quiet
and produces a noticeable and uncomfortable change in volume when a
new channel is introduced.

Surely there is some sort of formula I can implement which will
eliminate this problem, considering just about every software DAW can
pull this off without a problem. 

I would really appreaciate any sort of help, even just pointing me in
the direction of a website or book, as this problem has been bugging
me for weeks.

Thanks.
------------------------------------



(You need to be a member of audiodsp -- send a blank email to audiodsp-subscribe@yahoogroups.com )

Re:Mixing down from multiple input sources - Nishit Jain - Jul 15 7:10:11 2008

Hi,

As you said, simply adding the samples of different channels will definitely saturate in the
cases where the dynamic range of the channels is high. Instead, we should normalize each
channel and then take the average of all. This is better explained as follows: 

Expand (or compress) the range of each of the input channels to a fixed range (say 0.9, where 1
is the max of 16bit precision ). Now add each channel and divide the sum by total number of
channels. Whenever you add a new channel, first expand (or compress) the range of the channel
to that fixed value (as mentioned above), then do the appropriate averaging so that the final
level (range) of the output remains the same. I think this is the simplest formula which can
give decent results. I never tried this but am working on a similar situation.

Hope this helps.

Nishit Jain 
Samsung India Software Operations (SISO)  Bangalore  Ph : 093412 54321  
"Don't limit your Challenges---Challenge your Limits" 

---

        Mixing down from multiple input sources      
    
    Posted by:      "d.abc51"      
      d...@yahoo.com

          d.abc51

      Sun Jul 13, 2008 7:10 pm        (PDT)

            Hi all, I'm trying to code a program that can mix together multiple

PCM wav files into a single output. It is essentially a sequencer, and

works fine at points in the sequence where only one or two sounds are

playing, however any more than that and the distortion can become

unbearable.

All I am doing right now is adding the sample values for each channel

together and taking the sum of these as my output. However all too

often this value will be beyond the range of a 16 bit samplerate,

which results in clipping and distortion.

I have tried dividing by the number of input streams at any given time

but while it eliminates distortion, this can make the output too quiet

and produces a noticeable and uncomfortable change in volume when a

new channel is introduced.

Surely there is some sort of formula I can implement which will

eliminate this problem, considering just about every software DAW can

pull this off without a problem. 

I would really appreaciate any sort of help, even just pointing me in

the direction of a website or book, as this problem has been bugging

me for weeks.

Thanks.

------------------------------------



(You need to be a member of audiodsp -- send a blank email to audiodsp-subscribe@yahoogroups.com )

Re: Mixing down from multiple input sources - Twafik Mohamed - Jul 15 7:10:27 2008

Hi,

There are many standard down-mixes, as you have not mentioned the number of
input channels, I am conveniently assuming that you are trying to down mix
5.1-:). The most common stereo downmixes would be the Lt/Rt and Lo/Ro
downmixes.

The Lt/Rt (left-total/right-total) is commonly used in TV transmissions a
surround-compatible downmix of the multichannel source program. The Lt/Rt
downmix sums the surround channels, attenuates them 3 dB and adds them
out-of-phase to the left channel and in-phase to the right channel.
The formula for Lt/Rt compatible downmix is:
Lt = L + (0.707*C) - (0.707*Ls) - (0.707*Rs)
Rt = R + (0.707*C) + (0.707*Ls) + (0.707*Rs)

The Lo/Ro downmix (left-only/right-only) is a simpler downmix suitable for
playback on a two-channel stereo system or on headphones. The formula for
Lo/Ro compatible downmix is:
Lo = L + (0.707*C) + (0.707*Ls)
Ro = R + (0.707*C) + (0.707*Rs)

The producers and engineers guide is an excellent guide to mixing.
http://www.grammy.com/PDFs/Recording_Academy/Producers_And_Engineers/5_1_Rec.pdf
Cheers!
Twafik
On Mon, Jul 14, 2008 at 12:43 AM, d.abc51 <d...@yahoo.com> wrote:

>   Hi all, I'm trying to code a program that can mix together multiple
> PCM wav files into a single output. It is essentially a sequencer, and
> works fine at points in the sequence where only one or two sounds are
> playing, however any more than that and the distortion can become
> unbearable.
>
> All I am doing right now is adding the sample values for each channel
> together and taking the sum of these as my output. However all too
> often this value will be beyond the range of a 16 bit samplerate,
> which results in clipping and distortion.
>
> I have tried dividing by the number of input streams at any given time
> but while it eliminates distortion, this can make the output too quiet
> and produces a noticeable and uncomfortable change in volume when a
> new channel is introduced.
>
> Surely there is some sort of formula I can implement which will
> eliminate this problem, considering just about every software DAW can
> pull this off without a problem.
>
> I would really appreaciate any sort of help, even just pointing me in
> the direction of a website or book, as this problem has been bugging
> me for weeks.
>
> Thanks.
>

-- 
Best Regards,
Twafik
------------------------------------



(You need to be a member of audiodsp -- send a blank email to audiodsp-subscribe@yahoogroups.com )

Re: Re:Mixing down from multiple input sources - 陈强 - Sep 13 16:27:18 2008

 I'm puzzled. for example, the first channel's input value is 16, and the seconde
channel's input value is 128 or 256 and so on, now we expand the two number to 16384, and we
get the averaging ---16384. i think  therer maybe wrong before two or more data add ,we
normalize them.

在2008-07-15 13:30:58,"Nishit Jain" <b...@yahoo.co.in> 写道:
Hi,

As you said, simply adding the samples of different channels will definitely saturate in the
cases where the dynamic range of the channels is high. Instead, we should normalize each
channel and then take the average of all. This is better explained as follows: 

Expand (or compress) the range of each of the input channels to a fixed range (say 0.9, where 1
is the max of 16bit precision ). Now add each channel and divide the sum by total number of
channels. Whenever you add a new channel, first expand (or compress) the range of the channel
to that fixed value (as mentioned above), then do the appropriate averaging so that the final
level (range) of the output remains the same. I think this is the simplest formula which can
give decent results. I never tried this but am working on a similar situation.

Hope this helps.

Nishit Jain 
Samsung India Software Operations (SISO) Bangalore Ph : 093412 54321 
"Don't limit your Challenges---Challenge your Limits" 

---

Mixing down from multiple input sources 

Posted by: "d.abc51" 
d...@yahoo.com
d.abc51 

Sun Jul 13, 2008 7:10 pm (PDT) 

Hi all, I'm trying to code a program that can mix together multiple

PCM wav files into a single output. It is essentially a sequencer, and

works fine at points in the sequence where only one or two sounds are

playing, however any more than that and the distortion can become

unbearable.

All I am doing right now is adding the sample values for each channel

together and taking the sum of these as my output. However all too

often this value will be beyond the range of a 16 bit samplerate,

which results in clipping and distortion.

I have tried dividing by the number of input streams at any given time

but while it eliminates distortion, this can make the output too quiet

and produces a noticeable and uncomfortable change in volume when a

new channel is introduced.

Surely there is some sort of formula I can implement which will

eliminate this problem, considering just about every software DAW can

pull this off without a problem. 

I would really appreaciate any sort of help, even just pointing me in

the direction of a website or book, as this problem has been bugging

me for weeks.

Thanks.



(You need to be a member of audiodsp -- send a blank email to audiodsp-subscribe@yahoogroups.com )

Re:Re: Mixing down from multiple input sources - 陈强 - Sep 13 16:27:28 2008

 
The technology mentioned by you come from AAC or MP3. I think the topic discussed currently by
us is  multi-meeting of voip.

在2008-07-15 13:54:38,"Twafik Mohamed" <t...@gmail.com> 写道:
Hi,

There are many standard down-mixes, as you have not mentioned the number of
input channels, I am conveniently assuming that you are trying to down mix
5.1-:). The most common stereo downmixes would be the Lt/Rt and Lo/Ro
downmixes.

The Lt/Rt (left-total/right-total) is commonly used in TV transmissions a
surround-compatible downmix of the multichannel source program. The Lt/Rt
downmix sums the surround channels, attenuates them 3 dB and adds them
out-of-phase to the left channel and in-phase to the right channel.
The formula for Lt/Rt compatible downmix is:
Lt = L + (0.707*C) - (0.707*Ls) - (0.707*Rs)
Rt = R + (0.707*C) + (0.707*Ls) + (0.707*Rs)

The Lo/Ro downmix (left-only/right-only) is a simpler downmix suitable for
playback on a two-channel stereo system or on headphones. The formula for
Lo/Ro compatible downmix is:
Lo = L + (0.707*C) + (0.707*Ls)
Ro = R + (0.707*C) + (0.707*Rs)

The producers and engineers guide is an excellent guide to mixing.
http://www.grammy.com/PDFs/Recording_Academy/Producers_And_Engineers/5_1_Rec.pdf
Cheers!
Twafik
On Mon, Jul 14, 2008 at 12:43 AM, d.abc51 <d...@yahoo.com> wrote:

> Hi all, I'm trying to code a program that can mix together multiple
> PCM wav files into a single output. It is essentially a sequencer, and
> works fine at points in the sequence where only one or two sounds are
> playing, however any more than that and the distortion can become
> unbearable.
>
> All I am doing right now is adding the sample values for each channel
> together and taking the sum of these as my output. However all too
> often this value will be beyond the range of a 16 bit samplerate,
> which results in clipping and distortion.
>
> I have tried dividing by the number of input streams at any given time
> but while it eliminates distortion, this can make the output too quiet
> and produces a noticeable and uncomfortable change in volume when a
> new channel is introduced.
>
> Surely there is some sort of formula I can implement which will
> eliminate this problem, considering just about every software DAW can
> pull this off without a problem.
>
> I would really appreaciate any sort of help, even just pointing me in
> the direction of a website or book, as this problem has been bugging
> me for weeks.
>
> Thanks.
>

-- 
Best Regards,
Twafik



(You need to be a member of audiodsp -- send a blank email to audiodsp-subscribe@yahoogroups.com )