MonoToStereo(left_channel_clip clip, right_channel_clip clip) 

Starting from v2.5 MonoToStereo is replaced by MergeChannels. MonoToStereo converts 
two mono signals to one stereo signal. This can be used, if one or both channels has
been modified seperately, and then has to be recombined. 

The sample rate of the two clips need to be the same (use ResampleAudio if this 
is a problem). If either of the sources are in stereo, the signal will be taken 
from the corresponding channel (left channel from the left channel clip, and vice 
versa for right channel).

Example: 

# combines two separate wave sources to a stereo signal:
left_channel = WavSource("c:\left_channel.wav")
right_channel = WavSource("c:\right_channel.wav")
return MonoToStereo(left_channel, right_channel)

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

ConvertToMono(clip clip) 

Prior to v2.5 it converts a stereo signal to mono, and starting from v2.5 
it converts a multichannel signal to mono. If the signal is already in mono, 
it is returned untouched.

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

MixAudio(clip1 clip, clip2 clip, float clip1_factor, float clip2_factor) 

Mixes audio from two clips. A volume for the two clips can be given, but is optional. 

Volume is given as a factor, where 0.0 is no audio from the desired channel, and 1.0 
is 100% from the desired channel. Default is 0.5/0.5 - if only one factor is given, the 
other channel will be 1.0-(factor). If factor1 + factor2 is more than 1.0, you risk 
clipping your signal. 

The sample rate of the two clips needs to be the same (use ResampleAudio if necessary). 
Your clips need also to have the same number of channels (stereo/mono) - 
use ConvertToMono or MonoToStereo / MergeChannels if necessary. 

Example:

# mixes two sources, with one source slightly lower than the other.

video = AviSource("c:\movie.avi'')

Soundtrack = WavSource("c:\soundtrack.wav")

Speak = WavSource("c:\speak.wav")

audio = MixAudio(Soundtrack, Speak, 0.75, 0.25) # The Expert may notice that the last 
0.25 is actually redundant here.

return AudioDub(video, audio)

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

GetChannel(clip clip, int ch1 [, int ch2, ...])

GetLeftChannel(clip clip) 

GetRightChannel(clip clip) 

Prior to v2.5 GetLeftChannel returns the left and GetRightChannel the right channel from a stereo signal. GetChannel is present starting from v2.5 and it returns one or more channels of a multichannel signal. The ordening of the channels is determined by the ordening of the input file, because AviSynth doesn't assume any ordening. In case of stereo 2.0 WAV and 5.1 WAV files the ordening should be as follows:

WAV 2 ch (stereo):

1  left channel  
2  right channel  

WAV 5.1 ch:

1  front left channel  
2  front right channel  
3  front center channel  
4  LFE (Subwoofer)  
5  rear left channel  
6  rear right channel  

Examples:

# Removes right channel information, and return as mono clip with only left channel:
video = AviSource("c:\filename.avi")
stereo = WavSource("c:\afx-ab3_t4.wav")
mono = GetLeftChannel(stereo)
return AudioDub(video, mono)

# Using v2.5 this becomes:
video = AviSource("c:\filename.avi")
stereo = WavSource("c:\afx-ab3_t4.wav")
mono = GetChannel(stereo, 1)
return AudioDub(video, mono)

# You could also obtain the channels from the avi file itself:
video = AviSource("c:\filename.avi")
return GetChannel(video, 1)

# Converts avi with "uncompressed 5.1 wav" audio to a stereo signal:
video = AviSource("c:\divx_wav.avi")
audio = WavSource(c:\divx_wav.avi)
stereo = GetChannel(audio, 1, 2)
return AudioDub(video, stereo)
Remark1:

Every file format has a different channel ordening. The following table gives this ordening for some formats 
(useful for plugin writers :))

reference:  channel 1:  channel 2:  channel 3:  channel 4:  channel 5:  channel 6:  
[5.1 WAV]  front left channel  front right channel  front center channel  LFE  rear left channel  rear right channel  
[5.1 AC3]  front left channel  front center channel  front right channel  rear left channel  rear right channel  LFE  
[5.1 DTS]  front center channel  front left channel  front right channel  rear left channel  rear right channel  LFE  
[5.1 AAC]  front center channel  front left channel  front right channel  rear left channel  rear right channel  LFE  
[5.1 AIFF]  front left channel  rear left channel  front center channel  front right channel  rear right channel  LFE  

5.1 DTS: the LFE is on a separate stream (much like on multichannel MPEG2). 
AAC specifications are unavailable on the internet (a free version)? 
Remark2:

At the time of writing, BeSweet still has the [2GB barrier]. So make sure that the size of the 5.1 WAV is 
below 2GB, otherwise encode to six separate wavs or use HeadAC3he.

Remark3:

GetChannels is an alias to GetChannel and they can be used interchangeably. The syntax is the same for both.

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

MergeChannels(clip1 clip, clip2 clip [, clip3 clip])

Starting from v2.5 MergeChannels replaces MonoToStereo, and can be used to merge the audio channels of two or more clips.

Example, converts "uncompressed wav" audio to a 44.1 kHz stereo signal:

video = AviSource("c:\divx_wav.avi")
audio = WavSource("c:\divx_wav.avi")
l_ch = GetChannel(audio, 1)
r_ch = GetChannel(audio, 2)
stereo = MergeChannels(l_ch, r_ch).ResampleAudio(44100)
return AudioDub(video, stereo)

Note, this is similar to:

video = AviSource("c:\divx_wav.avi")
audio = WavSource("c:\divx_wav.avi")
stereo = GetChannel(audio, 1, 2).ResampleAudio(44100)
return AudioDub(video, stereo)

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