View Single Post
Old 20th December 2010, 16:17   #899  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 6,915
Quote:
Originally Posted by TDiTP_ View Post
What matrix do you recommend to use when downmix 7.1 and 6.1 -> 5.1 ? And what script i must use in BeHappy?...
To avoid overflow, first convert to float, mix, Normalize and convert to desired output.
Code:
# Downmix 7.1 to 5.1
RaWavSource("341.wav") # or 341.w64
a = ConvertAudiotofloat()
fl = Getchannel(a,1)
fr = Getchannel(a,2)
fc = Getchannel(a,3)
lf = Getchannel(a,4)
bl = Getchannel(a,5)
br = Getchannel(a,6)
sl = Getchannel(a,7)
sr = Getchannel(a,8)
sul = Mixaudio(sl, bl, 1.0, 1.0)
sur = Mixaudio(sr, br, 1.0, 1.0)
Mergechannels(fl, fr, fc, lf, sul, sur)
Normalize()
#ConvertaudiotoX()  # not needed to encode to ac3/aac
With:
sul = sl + bl
sur = sr + br
We preserve the acustic power relation between all channels. Don't mistake upmix (we need divide a channel in two, angle related) with downmix (we add channels and both must have the same contribution)

For 6.1
Code:
# Downmix 6.1 to 5.1
RaWavSource("331.wav") # or 331.w64, with channelmask like eac3to output, else alternate sintax
a = ConvertAudiotofloat()
fl = Getchannel(a,1)
fr = Getchannel(a,2)
fc = Getchannel(a,3)
lf = Getchannel(a,4)
bc = Getchannel(a,5) # bl = Getchannel(a,5)
sl = Getchannel(a,6) # br = Getchannel(a,6)
sr = Getchannel(a,7) # bc = Getchannel(a,7)
sul = Mixaudio(sl, bc, 1.0, 0.707)  # Mixaudio(bl, bc, 1.0, 0.707)
sur = Mixaudio(sr, bc, 1.0, 0.707)  # Mixaudio(br, bc, 1.0, 0.707)
Mergechannels(fl, fr, fc, lf, sul, sur)
Normalize()
#ConvertaudiotoX()  # not needed to encode to ac3/aac
With:
sul = sl + 0.707xbc
sur = sr + 0.707xbc
Here the acustic power of bc must be divided in two channel. Like acustic power is proportional to bc^2:
bc^2 = ( 0.707xbc)^2 + (0.707xbc)^2
__________________
BeHappy, AviSynth audio transcoder.
tebasuna51 is offline   Reply With Quote