View Full Version : BeHappy - AviSynth based audio transcoding tool (UPD 19-07-2006)
dimzon
31st January 2006, 13:59
Now I'm working with compand function from Sox, trying to do a Dynamic Range Compression DSP function for BeHappy.
Sounds great! Please, keep me informed. I'm working on MeGUI right now and have no time for BeHappy
NorthPole
31st January 2006, 14:42
@dimzon
here are the feq files that I used
Front.feq
-96
-96
-96
-4
-4
-4
-4
-4
-4
-4
-4
-4
-4
-4
-4
-96
-96
-96
center.feq
-96
-96
-96
-96
-96
-96
3
3
3
3
3
3
3
3
3
3
3
3
lfe.feq
0
0
0
-96
-96
-96
-96
-96
-96
-96
-96
-96
-96
-96
-96
-96
-96
-96
back.feq
-96
-96
-96
-6
-6
-6
-6
-6
-6
-6
-6
-6
-6
-6
-6
-96
-96
-96
They are just text files that can be cut and pasted using notepad.
I didn't spend as much time on these as I did the sox filter because I thought the sox filter had better potential. However these do work fine. Both methods were geared toward more of a "surround sound" mix for dvd movies and recorded tv. I was trying to get the dialoge in the center channel and added a 20ms delay on the back channels.
dimzon
31st January 2006, 15:11
@NorthPole
sl_{2} = SuperEQ(Stereo_{2}.getleftchannel,"c:\program files\behappy\back.feq")
sr_{2} = SuperEQ(Stereo_{2}.getrightchannel,"c:\program files\behappy\back.feq")
Is'nt more efficient to use
temp{2} = SuperEQ(Stereo_{2}, "c:\program files\behappy\back.feq");
sl_{2} = temp{2}.getleftchannel()
sr_{2} = temp{2}.getrightchannel()
NorthPole
31st January 2006, 17:48
@dimzon
Yes, your code looks better, only one pass thru with the eq. then split.
2 comments on the sox method.
I think the lfe is either too loud or needs lower freq. setting. Currently at 65
for lowpass
May be more efficient to run sox mixaudio once on stereo source then split for left and right like it is currently but then instead of running sox filter again on stereo source for back channels, just reduce volume by a percentage from the front channels?
NorthPole
31st January 2006, 18:02
@dimzon
Is semicolon important at the end of you temp{2} line or is it a typo?
dimzon
31st January 2006, 18:56
@dimzon
Is semicolon important at the end of you temp{2} line or is it a typo?
typo ;)
NorthPole
31st January 2006, 19:06
@dimzon
I think the lfe is either too loud or needs lower freq. setting. Currently at 65
for lowpass
I think this is better
lfe_{2} = ConvertToMono(stereo_{2}).SoxFilter("lowpass 100","vol 0.5")
NorthPole
31st January 2006, 19:20
May be more efficient to run sox mixaudio once on stereo source then split for left and right like it is currently but then instead of running sox filter again on stereo source for back channels, just reduce volume by a percentage from the front channels?
Tried to change volume and/or amplify front_{2} but doesn't work. Behappy terminated almost immediately. I think the sox filter crashes behappy in this situation.
dimzon
1st February 2006, 14:14
http://img64.imageshack.us/img64/7012/newpng5lg.png
new enc_aacplus.extension is avaluable @ BeHappy workspace
tebasuna51
2nd February 2006, 13:43
DynRanComp: New <AudioDSP> Dynamic Range Compression based in compand function from Sox.
Compression curves based in Anex C from Dolby Digital Professional Encoding Guidelines. There are a link for this document and graphs in:
http://forum.doom9.org/showthread.php?t=56020
This is a test release for discussion about the following problems:
1) The DSP function, outside the ac3 decoder, can't know the original ac3 Dialog Normalization and DRC method, then must be supplied by the user.
The DRC method can be selected in DSP configure, but the DialNorm can be set with:
- Another DSP multioption (31) to use before DynRanComp.
- With the 'Tweak' Amplify, but don't work with negative values (? to Dimzon).
- Editing DynRanComp.extension before run BeHappy. Method selected in this test release.
2) The Normalize() function don't work after Sox compand, maybe because:
"compand is very hard to control, and doesn't support restarts (crash)"
(in "Sox Audio Effect Filter for AviSynth" doc.)
Then maybe we need another set of 'normalized' curves to avoid the low volume problem.
3) The compand function don't work fine with segments 20:1.
For segment (-21,-21)-(0,-20) I obtain a output (-21,-21)-(0,-18)
4) The compand parameters (attack1,decay1,...,delay) may need optimization.
The DynRanComp.extension file is:
<?xml version="1.0"?>
<BeHappy.Extension xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://workspaces.gotdotnet.com/behappy">
<AudioDSP UniqueID="934f5ce0-9203-11da-a72b-0800200c9a66">
<Plugin>
<MultiOptionDSP Type="BeHappy.Extensions.MultiOptionDSP, BeHappy">
<TitleFormatString>DynRanComp - {0}</TitleFormatString>
<ScriptPrologue>
# Dialog Normalization. Amplify by: -31 -(DialNorm), 0 for DN=-31, -4 for DN=-27, -11 for DN=-20 ...
# AmplifydB(-4.0)
# Define transformation function
</ScriptPrologue>
<Option>
<Name>Film Standard</Name>
<Value>
# Film Standard. Segments: (Noise) +6dB 2:1 = 20:1
# Points: ------- ------- ------- ------- ------- -----
SoxFilter("compand 0.1,0.3 -90,-90,-70,-64,-43,-37,-31,-31,-21,-21,0,-20 0 0 0.1")
</Value>
</Option>
<Option>
<Name>Film Light</Name>
<Value>
# Film Light Segments: (Noise) +6dB 2:1 = 20:1
# Points: ------- ------- ------- ------- ------- -----
SoxFilter("compand 0.1,0.3 -90,-90,-70,-64,-53,-47,-41,-41,-21,-21,0,-20 0 0 0.1")
</Value>
</Option>
<Option>
<Name>Music Standard</Name>
<Value>
# Music Standard Segments: (Noise) +12dB 2:1 = 20:1
# Points: ------- ------- ------- ------- ------- -----
SoxFilter("compand 0.1,0.3 -90,-90,-70,-58,-55,-43,-31,-31,-21,-21,0,-20 0 0 0.1")
</Value>
</Option>
<Option>
<Name>Music Light</Name>
<Value>
# Music Light Segments: (Noise) +12dB 2:1 = 2:1
# Points: ------- ------- ------- ------- ------- -----
SoxFilter("compand 0.1,0.3 -90,-90,-70,-58,-65,-53,-41,-41,-21,-21,0,-11 0 0 0.1")
</Value>
</Option>
<Option>
<Name>Speech</Name>
<Value>
# Speech Segments: (Noise) +15dB 5:1 = 20:1
# Points: ------- ------- ------- ------- ------- -----
SoxFilter("compand 0.1,0.3 -90,-90,-70,-55,-50,-35,-31,-31,-21,-21,0,-20 0 0 0.1")
</Value>
</Option>
<ScriptEpilogue>
# Normalize recommended because volume is always less than -20 dB (except Music Light -11)
# Normalize() # But Normalize don't work after SoxFilter("compand...")
# SoxFilter work with 32 bit integer, and at last wav output is send 32 bit. Then maybe...:
# ConvertAudioTo16Bit()
</ScriptEpilogue>
</MultiOptionDSP>
</Plugin>
</AudioDSP>
</BeHappy.Extension>
dimzon
2nd February 2006, 13:54
@tebasuna51
Great!
Unfortunally I'm not DSP expert.
Why not to use Normalize() BEFORE Dynamic Range Compression?
tebasuna51
2nd February 2006, 15:54
Why not to use Normalize() BEFORE Dynamic Range Compression?
The decoder output (NicAudio) have the full dynamic range and can have samples with 0 dB, then the Normalize function do nothing with this signal.
We need, also, apply attenuation over the decoder output to compensate DialNorm (if distinct of -31 dB) for input correctly in DRC curves.
The solution is make alternate curves with normalized output. I'm work about this.
dimzon
2nd February 2006, 16:34
The decoder output (NicAudio) have the full dynamic range and can have samples with 0 dB, then the Normalize function do nothing with this signal.
Do not forget - we can use DRC on NON-AC3 input ;)
The solution is make alternate curves with normalized output. I'm work about this.
Yeah, it's the best
dimzon
2nd February 2006, 18:57
fresh beta is out
Dayvon
2nd February 2006, 19:34
2 All
Hi! You can help BeHappy project!
I need:
BeHappy logo & icons
I'd like to help with this Dimzon. You have any preferences or specifics in mind?
NorthPole
3rd February 2006, 04:34
Made some changes to the upmix extension I posted earlier...
Removed the option to use the avisynth equilizer because it is extremely slow in execution.
I added a second upix option that tries to remove most of the dialog from the left, right and surround speakers and sends it just to the center speaker.
Also, inverted the LFE, attenuated and delayed the surround speakers as before.
<?xml version="1.0"?>
<BeHappy.Extension xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://workspaces.gotdotnet.com/behappy">
<AudioDSP UniqueID="9579E57B-2D27-4583-99A4-921718E25B41">
<Plugin>
<MultiOptionDSP Type="BeHappy.Extensions.MultiOptionDSP, BeHappy">
<TitleFormatString>{0}</TitleFormatString>
<ScriptPrologue>
# Store clip in variable
Stereo_{2} = convertaudiotofloat(last)
</ScriptPrologue>
<Option>
<Name>Upmix with equalizer adjustments</Name>
<Value>
# Sox filter using frequency selection, 20ms surround delay and attenuation
Front_{2} = mixaudio(Stereo_{2}.soxfilter("filter 0-600"),mixaudio(Stereo_{2}.soxfilter("filter 600-1200"),Stereo_{2}.soxfilter("filter 1200-7000"),0.45,0.25),0.50,1)
Back_{2} = mixaudio(Stereo_{2}.soxfilter("filter 0-600"),mixaudio(Stereo_{2}.soxfilter("filter 600-1200"),Stereo_{2}.soxfilter("filter 1200-7000"),0.35,0.15),0.40,1)
fl_{2} = GetLeftChannel(Front_{2})
fr_{2} = GetRightChannel(Front_{2})
cc_{2} = ConvertToMono(stereo_{2}).SoxFilter("filter 625-24000")
lfe_{2} = ConvertToMono(stereo_{2}).SoxFilter("lowpass 100","vol -0.5")
sl_{2} = GetLeftChannel(Back_{2})
sr_{2} = GetRightChannel(Back_{2})
sl_{2} = DelayAudio(sl_{2},0.02)
sr_{2} = DelayAudio(sr_{2},0.02)
</Value>
</Option>
<Option>
<Name>Upmix with center channel dialog</Name>
<Value>
# channel subtraction with sox filter, 20ms surround delay and attenuation
left_{2} = stereo_{2}.GetLeftChannel()
right_{2} = stereo_{2}.GetRightChannel()
fl_{2} = mixaudio(left_{2}.soxfilter("filter 0-24000"),right_{2}.soxfilter("filter 0-24000"),0.6,-0.5)
fr_{2} = mixaudio(right_{2}.soxfilter("filter 0-24000"),left_{2}.soxfilter("filter 0-24000"),0.6,-0.5)
cc_{2} = ConvertToMono(stereo_{2}).SoxFilter("filter 625-24000")
lfe_{2} = ConvertToMono(stereo_{2}).SoxFilter("lowpass 100","vol -0.5")
sl_{2} = mixaudio(left_{2}.soxfilter("filter 0-24000"),right_{2}.soxfilter("filter 0-24000"),0.5,-0.4)
sr_{2} = mixaudio(right_{2}.soxfilter("filter 0-24000"),left_{2}.soxfilter("filter 0-24000"),0.5,-0.4)
sl_{2} = DelayAudio(sl_{2},0.02)
sr_{2} = DelayAudio(sr_{2},0.02)
</Value>
</Option>
<ScriptEpilogue>
# Return result
MergeChannels( fl_{2}, fr_{2}, cc_{2}, lfe_{2}, sl_{2}, sr_{2})
ConvertAudioTo16Bit()
</ScriptEpilogue>
</MultiOptionDSP>
</Plugin>
</AudioDSP>
</BeHappy.Extension>
@tebasuna51
Nice dynamic range compression extension. I agree that it would be nice to be able to use negative values in tweak.
@Dimzon
I tried this code but it executed extremely slowly
left_{2} = last.GetLeftChannel()
right_{2} = last.GetRightChannel()
fl_{2} = mixaudio(left_{2},right_{2},0.6,-0.5)
fr_{2} = mixaudio(right_{2},left_{2},0.6,-0.5)
cc_{2} = ConvertToMono(stereo_{2}).SoxFilter("filter 625-24000")
lfe_{2} = ConvertToMono(stereo_{2}).SoxFilter("lowpass 100","vol -0.5")
sl_{2} = mixaudio(left_{2},right_{2},0.5,-0.4)
sr_{2} = mixaudio(right_{2},left_{2},0.5,-0.4)
sl_{2} = DelayAudio(sl_{2},0.02)
sr_{2} = DelayAudio(sr_{2},0.02)
dimzon
3rd February 2006, 11:07
I'd like to help with this Dimzon. You have any preferences or specifics in mind?
Just make it eyecandy ;)
Dayvon
3rd February 2006, 16:39
Just make it eyecandy ;)
Is this creative liberty you've given me? :D :devil:
dimzon
3rd February 2006, 16:45
Is this creative liberty you've given me? :D :devil:
Yes.
By the way - since BeHappy is avisynth based software maybe we can use portion of avisynth logo in it (just proposal, feel free not to do it)
Dayvon
3rd February 2006, 17:12
Yes.
By the way - since BeHappy is avisynth based software maybe we can use portion of avisynth logo in it (just proposal, feel free not to do it)
I'll look into it! :cool:
tebasuna51
4th February 2006, 12:59
@Dimzon
I get incorrect wav output (BlockAlign incorrect) with your last release (and also incorrect aac encodes).
Maybe there are a bug in Encoder.cs (now there are 2 writeHeader routines)
CORRECT:
private void writeHeader(Stream target ) {
...
target.Write(BitConverter.GetBytes(m_wavHeader.nBlockAlign),0,2);
target.Write(BitConverter.GetBytes(m_wavHeader.wBitsPerSample),0,2);
...
}
INCORRECT:
private void writeHeader(Stream target, AviSynthClip x ) {
...
target.Write(BitConverter.GetBytes(x.BitsPerSample/8),0,2); // ?????
target.Write(BitConverter.GetBytes(x.BitsPerSample),0,2);
...
}
BUG: BlockAlign = ChannelsCount * BitsPerSample/8
TheBashar
4th February 2006, 22:07
Can someone please give me a sanity check with this scheme? I like to cut out the opening and ending credits of my TV series encodes with something like Trim(90,6000)+Trim(9000,61000) for the video. Cutting, merging, and muxing the audio is ehh okay, but I've always struggled with some synch issues.
I'd like to try avisynth processing via BeHappy to see if I can use the same Trim statements to manipulate the audio as I do with the video so maybe I can avoid or eliminate the synch issues.
I set up BeHappy to do an ac3 -> aac conversion and exported the avs to look at. I was wondering if this would work.
audio = DirectShowSource("audio.ac3")
audio = EnsureVBRMP3Sync(audio)
# Above same as BeHappy Generated:
video = MPEG2Source("video.d2v")
AudioDeubEx(video, audio)
# Use same trim arguments as in video encoding script:
Trim(90,6000)+Trim(9000,61000)
AudioDubEx(Tone(), last)
# Below same as BeHappy Generated:
AudioDubEx(BlankClip(length=Int(1000*AudioLengthF(last)/Audiorate(last)), width=320,height=32,pixel_type="RGB24",fps=1000), last)
Normalize...
Encode...
Kill Video again...
So in essence I'd bring in the audio, apply the vbrsynch black magic, dub it to the actual video clip, trim with the video trim settings, kill the real video, dub it to the 1000 fps blank video, normalize, encode, and kill the blank video.
Is this a sane way to go about this task?
Thanks!
tebasuna51
5th February 2006, 01:37
You don't need:
AudioDubEx(BlankClip(length=Int(1000*AudioLengthF(last)/Audiorate(last)), width=320,height=32,pixel_type="RGB24",fps=1000), last)
...
Kill Video again...
Because this AudioDubEx sentence is only to use Trim in ms. (fps=1000), and Trim is used before based in video fps.
If you want maintain the ac3 without re-encode there are other method to trim the audio with DelayCut:
You want a first segment like this: Trim(90,6000)
If fps is 25 (replace 25 with your appropriate fps) you want a segment between 90/25 = 3.6 sec and 6000/25 = 240 sec. Then open DelayCut and Cut your original ac3 between Start = 3600 and End = 240000 ms.
For the second segment Cut between 360000 ms (9000/25 sec) and 2440000 ms. (61000/25 sec).
After join the two segments with:
> copy /B first.ac3 + second.ac3 full.ac3
dimzon
6th February 2006, 11:56
BUG: BlockAlign = ChannelsCount * BitsPerSample/8
Are you 100% shure? (this will affect MeGUI too)
tebasuna51
6th February 2006, 13:06
Are you 100% shure? (this will affect MeGUI too)
With this kind of wavheader (PCM 16 or 32 bits int) always:
BlockAlign = ChannelsCount * BitsPerSample/8
dimzon
6th February 2006, 13:09
With this kind of wavheader (PCM 16 or 32 bits int) always:
BlockAlign = ChannelsCount * BitsPerSample/8
Thanx a lot, will be fixed soon
dimzon
6th February 2006, 14:34
http://forum.doom9.org/showthread.php?t=83752 - additional info about 5.1 upmix
3dsnar
7th February 2006, 15:27
Hi Dimzon. I have prepared the pseudosurround DLL for ya :D
I cannot attach it to this post, cause it is to big.
Please drop me an email: programmers AT aud-x.com
and I will reply and send you the attachement.
(ie. the DLL, and the complete project. Maybe it will be useful)
After downloading, please let me know, and I will remove it.
I will be happy to answer all your questions (if you have any).
shon3i
7th February 2006, 15:33
@Dimzon how to boost 6ch audio aac like hibridgain in besweet or autogk with mp3 ,with behappy
grokwik
14th February 2006, 00:11
Dimzon, thanks a lot for this awsome tool !
I can now transcode audio from multiple avi quickly. Every thing works fine.
I have noticed that nero aac encode works with or without neroipp.dll without any difference. Is this dll really necessary ?
dimzon
14th February 2006, 12:23
I have noticed that nero aac encode works with or without neroipp.dll without any difference. Is this dll really necessary ?
It's really necessary if you does not have Nero installed
JoeBG
14th February 2006, 19:44
I cant get work
- upmix (is it still not supportet) (invalid arguments to function "SuperEq"
- normalize (nothing happens)
Do I need some special software packages?
tebasuna51
14th February 2006, 20:05
- Upmix is in experimental stage by NorthPole, and need Sox Audio Effect Filter ( http://forum.doom9.org/showthread.php?t=104792 ), see the post:
http://forum.doom9.org/showpost.php?p=779538&postcount=66
- Normalize works fine (amplify the signal until the required level).
JoeBG
14th February 2006, 20:50
- Upmix is in experimental stage by NorthPole, and need Sox Audio Effect Filter ( http://forum.doom9.org/showthread.php?t=104792 ), see the post:
http://forum.doom9.org/showpost.php?p=779538&postcount=66
Works fine now, many thanks ;)
- Normalize works fine (amplify the signal until the required level).
What means "amplify the signal until the rquired level
I told the tool to normalize to 100 %. Is this not ok?
tebasuna51
15th February 2006, 01:23
What means "amplify the signal until the rquired level
I told the tool to normalize to 100 %. Is this not ok?
I say "required level" only because you can select other value than 100% with the Configure button.
But, is true, the Normalize() function don't work after the upmix because do a second pass (the first to know the max value) to amplify the sound. And some Sox filters doesn't support restarts (crash), like say the documentation.
I have the same problem with the Dynamic Range Compession function and the compand Sox filter.
NorthPole
16th February 2006, 01:43
Well here is the latest revision on the upmix extension
<?xml version="1.0"?>
<BeHappy.Extension xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://workspaces.gotdotnet.com/behappy">
<AudioDSP UniqueID="9579E57B-2D27-4583-99A4-921718E25B41">
<Plugin>
<MultiOptionDSP Type="BeHappy.Extensions.MultiOptionDSP, BeHappy">
<TitleFormatString>5.1 Upmix - {0}</TitleFormatString>
<ScriptPrologue>
# Store clip in variable
Stereo_{2} = convertaudiotofloat(last)
</ScriptPrologue>
<Option>
<Name>Audio with mostly dialog (ie. Comedy, Drama)</Name>
<Value>
# Profile to use with audio sources that has mostly mono content. 20ms delay and -2db attenuation on surround
front_{2} = stereo_{2}.soxfilter("filter 20-20000")
back_{2} = stereo_{2}.soxfilter("filter 100-7000")
fl_{2} = mixaudio(front_{2}.GetLeftChannel(),front_{2}.GetRightChannel(),0.794,-0.794)
fr_{2} = mixaudio(front_{2}.GetRightChannel(),front_{2}.GetLeftChannel(),0.794,-0.794)
cc_{2} = mixaudio(mixaudio(front_{2}.GetLeftChannel(),fl_{2},1,-1),mixaudio(front_{2}.GetRightChannel(),fr_{2},1,-1),0.224,0.224)
lfe_{2} = ConvertToMono(stereo_{2}).SoxFilter("lowpass 120","vol -0.562")
sl_{2} = mixaudio(back_{2}.GetLeftChannel(),back_{2}.GetRightChannel(),0.631,-0.631)
sr_{2} = mixaudio(back_{2}.GetRightChannel(),back_{2}.GetLeftChannel(),0.631,-0.631)
sl_{2} = DelayAudio(sl_{2},0.02)
sr_{2} = DelayAudio(sr_{2},0.02)
</Value>
</Option>
<Option>
<Name>Audio with a mix of sounds (ie. Action, Adventure)</Name>
<Value>
# Profile to use with audio sources that more range of sound content. 20ms delay and -2db attenuation on surround
front_{2} = stereo_{2}.soxfilter("filter 20-20000")
back_{2} = stereo_{2}.soxfilter("filter 100-7000")
fl_{2} = mixaudio(front_{2}.GetLeftChannel(),front_{2}.GetRightChannel(),0.668,-0.668)
fr_{2} = mixaudio(front_{2}.GetRightChannel(),front_{2}.GetLeftChannel(),0.668,-0.668)
cc_{2} = mixaudio(mixaudio(front_{2}.GetLeftChannel(),fl_{2},1,-1),mixaudio(front_{2}.GetRightChannel(),fr_{2},1,-1),0.398,0.398)
lfe_{2} = ConvertToMono(stereo_{2}).SoxFilter("lowpass 120","vol -0.447")
sl_{2} = mixaudio(back_{2}.GetLeftChannel(),back_{2}.GetRightChannel(),0.531,-0.531)
sr_{2} = mixaudio(back_{2}.GetRightChannel(),back_{2}.GetLeftChannel(),0.531,-0.531)
sl_{2} = DelayAudio(sl_{2},0.02)
sr_{2} = DelayAudio(sr_{2},0.02)
</Value>
</Option>
<ScriptEpilogue>
# Return result
MergeChannels( fl_{2}, fr_{2}, cc_{2}, lfe_{2}, sl_{2}, sr_{2})
ConvertAudioTo16Bit()
</ScriptEpilogue>
</MultiOptionDSP>
</Plugin>
</AudioDSP>
</BeHappy.Extension>
changes are as follows:
- removed the frequency adjustment option because the quality was not very good.
- optimized sox filter usage to speed up execution.
- created 2 different sound profiles to use on different types of audio.
Notes on Usage:
1. You need to have the avisynth sox filter in the avisynth plugin subdirectory. See tebasuna51s' post above for the link.
2. Normalize you audio before upmix.
3. Choose a profile to upmix with from the 5.1 upmix config button.
If after upmixing, you can't hear the center channel dialog because the L & R channels are drowning it out, then try the other profile.
Also, you can add your own profile or change the above ones as needed.
@dimzon
Small feature request...
When you add a file to convert, the name of the destination file is shown as the same as the input file (excluding the dot extension) which is good. But when you add a 2nd file to convert, the destination file name doesn't change (it remains the same as the first). Therefore, you have to type in the destination file name.
Not a big deal if its a problem to change... I hope I explained that clearly enough?
iceborne
16th February 2006, 03:03
does downmixing dts to DLP II wav really work in behappy? wanted to know cause i like to trancode DLP II wav to itunes's aac format.
could you also clarify between DPL II and DPL II(lfe)?
which one is equivalent to "-azid( -s dplii -c normal -L -3db )"?
tebasuna51
16th February 2006, 17:53
DPL II is equal to "-azid( -s dplii )" (copied matrix).
DPL II(lfe) equivalent to "-azid( -s dplii -L -3db )".
The "-azid( -c normal )" switch is for Dynamic Range Compression not yet implemented in BeHappy (problem with compand Sox Filter and Normalice see: http://forum.doom9.org/showpost.php?p=779165&postcount=60 ).
If you have ffdshow like default directshow filter to play dts files you can use DirectShow input instead NicDtsSource, and use ffdshow Audio Decoder Configuration to set:
- Codecs -> Dtd - libdts, Dynamic range compression (Checked)
- Mixer -> Dolby Prologic II, LFE (Unchecked)
-Output -> Output sample - only checked 16 bit integer, Don't use WAVEFORMATEXTENSIBLE ...(Checked)
This is equivalent to "-azid( -s dplii -c normal -L -3db )". After use the Normalice DSP function in BeHappy and select your desired encoder.
I test this method with ac3 source, I hope works also with dts.
Edit: I make a test with dts source:
- Same volume output with NicDtsSource and with ffdshow (drc checked and drc unchecked) (?).
- The output length with NicDtsSource is 2:06.688 (like input) and with ffdshow is cut at 1:50.851 (?)
iceborne
16th February 2006, 23:39
from this thread
http://forum.doom9.org/showthread.php?s=&threadid=27936
"Pro Logic II with LFE (Not recommended by Dolby)"
... so i shouldn't even be using "-azid( -s dplii -L -3db )" anyways, correct?
For downmix you ever have to use DRC because more acoustic power will be concentrated in less channels!
what is frank trying to say? not use dynamic range or to use dynamic range on downmix?
tebasuna51
17th February 2006, 01:55
See also http://forum.doom9.org/showthread.php?t=57988 with the definitive matrix used in azid 1.9 and in DPL II in BeHappy.
... so i shouldn't even be using "-azid( -s dplii -L -3db )" anyways, correct?
From "214_Mixing with Dolby Pro Logic II Technology.pdf" :
"There are other concerns when adding an LFE signal to the mix. If the LFE is simply redistributed within the other channels of the mix, they will usually be subject to some low-frequency bandpass filtering. This filtering causes phase shifts of the LFE signal. When they are acoustically added within a room, these phase shifts are fairly subtle and often go unnoticed. However, when they are electronically added together with the five main channels in the encoder, they may produce less than desirable results at certain frequencies. For this reason, it is recommended that the LFE signal not be used in a Dolby Pro Logic II downmix unless it contains unique information that is not repeated in any of the five main channels."
Is your choice, possible artifacts/lose unique info (my choice is don't include LFE).
"For downmix you ever have to use DRC because more acoustic power will be concentrated in less channels!"
what is frank trying to say? not use dynamic range or to use dynamic range on downmix?
I think not use DRC. But isn't my opinion.
You must use DRC to decrease the original signal Dynamic Range if:
1) The source have a wide Dynamic Range (dialogs at -30 dB and explosions at 0 dB).
2) You have a bad/normal audio equipment without support for this wide range (noise with dialogs or explosions distorted) or you don't want disturb the neighbors.
3) You want reencode to a format without support for DRC in play time (mp3, aac, ...)
The DRC is independent and must be do before any downmix.
JoeBG
17th February 2006, 13:04
Hi,
upmix to 5.1 aac works great now for me. :) Many thanks.
What not works is AC3. Do I need any special plugins? ffmpeg or something like this? Can someone give a small HowTo? Thanks :)
dimzon
17th February 2006, 13:21
Hi,
upmix to 5.1 aac works great now for me. :) Many thanks.
What not works is AC3. Do I need any special plugins? ffmpeg or something like this? Can someone give a small HowTo? Thanks :)
You must place ffmpeg.exe into BeHappy folder
Warning! Some ffmpeg versions has buggy stdin support - such versions doesn't work with BeHappy. This version works fine:
ffmpeg version CVS, build 3211776, Copyright (c) 2000-2004 Fabrice Bellard
configuration: --enable-theora --enable-mp3lame --enable-libogg --enable-vorbis --enable-faad --e
nable-faac --enable-xvid --enable-x264 --enable-mingw32 --enable-a52 --enable-dts --enable-pp --enab
le-gpl --enable-memalign-hack --enable-amr_nb --enable-amr_wb
built on Sep 9 2005 04:00:51, gcc: 3.4.4 (mingw special)
NorthPole
18th February 2006, 02:29
I found some additional information on upmix profiles from a couple of other threads
http://forum.doom9.org/showthread.php?p=442997#post442997
http://forum.doom9.org/showthread.php?p=558760#post558760
So I added them to the upmix extension:
<?xml version="1.0"?>
<BeHappy.Extension xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://workspaces.gotdotnet.com/behappy">
<AudioDSP UniqueID="9579E57B-2D27-4583-99A4-921718E25B41">
<Plugin>
<MultiOptionDSP Type="BeHappy.Extensions.MultiOptionDSP, BeHappy">
<TitleFormatString>5.1 Upmix - {0}</TitleFormatString>
<ScriptPrologue>
# Store clip in variable
Stereo_{2} = convertaudiotofloat(last)
</ScriptPrologue>
<Option>
<Name>Audio with mostly dialog (ie. Comedy, Drama)</Name>
<Value>
# Profile to use with audio sources that have mostly mono content. 20ms delay and -3db attenuation on surround
# Note: the center channel is very weak for this profile
front_{2} = stereo_{2}.soxfilter("filter 20-20000")
back_{2} = stereo_{2}.soxfilter("filter 100-7000")
fl_{2} = mixaudio(front_{2}.GetLeftChannel(),front_{2}.GetRightChannel(),0.794,-0.794)
fr_{2} = mixaudio(front_{2}.GetRightChannel(),front_{2}.GetLeftChannel(),0.794,-0.794)
cc_{2} = mixaudio(mixaudio(front_{2}.GetLeftChannel(),fl_{2},1,-1),mixaudio(front_{2}.GetRightChannel(),fr_{2},1,-1),0.224,0.224)
lfe_{2} = ConvertToMono(stereo_{2}).SoxFilter("lowpass 120","vol -0.596")
sl_{2} = mixaudio(back_{2}.GetLeftChannel(),back_{2}.GetRightChannel(),0.562,-0.562)
sr_{2} = mixaudio(back_{2}.GetRightChannel(),back_{2}.GetLeftChannel(),0.562,-0.562)
sl_{2} = DelayAudio(sl_{2},0.02)
sr_{2} = DelayAudio(sr_{2},0.02)
</Value>
</Option>
<Option>
<Name>Audio with a mix of sounds (ie. Action, Adventure)</Name>
<Value>
# Profile to use with audio sources that have a wider range of sound content. 20ms delay and -3db attenuation on surround
# Note: General purpose profile
front_{2} = stereo_{2}.soxfilter("filter 20-20000")
back_{2} = stereo_{2}.soxfilter("filter 100-7000")
fl_{2} = mixaudio(front_{2}.GetLeftChannel(),front_{2}.GetRightChannel(),0.668,-0.668)
fr_{2} = mixaudio(front_{2}.GetRightChannel(),front_{2}.GetLeftChannel(),0.668,-0.668)
cc_{2} = mixaudio(mixaudio(front_{2}.GetLeftChannel(),fl_{2},1,-1),mixaudio(front_{2}.GetRightChannel(),fr_{2},1,-1),0.398,0.398)
lfe_{2} = ConvertToMono(stereo_{2}).SoxFilter("lowpass 120","vol -0.447")
sl_{2} = mixaudio(back_{2}.GetLeftChannel(),back_{2}.GetRightChannel(),0.473,-0.473)
sr_{2} = mixaudio(back_{2}.GetRightChannel(),back_{2}.GetLeftChannel(),0.473,-0.473)
sl_{2} = DelayAudio(sl_{2},0.02)
sr_{2} = DelayAudio(sr_{2},0.02)
</Value>
</Option>
<Option>
<Name>Gerzen Profile</Name>
<Value>
# Gerzen approach Profile modified with 20ms delay and some attenuation on surround
front_{2} = stereo_{2}.soxfilter("filter 20-20000")
back_{2} = stereo_{2}.soxfilter("filter 100-7000")
fl_{2} = mixaudio(front_{2}.GetLeftChannel(),front_{2}.GetRightChannel(),0.885,-0.115)
fr_{2} = mixaudio(front_{2}.GetRightChannel(),front_{2}.GetLeftChannel(),0.885,-0.115)
cc_{2} = mixaudio(front_{2}.GetRightChannel(),front_{2}.GetLeftChannel,0.4511,0.4511)
lfe_{2} = ConvertToMono(stereo_{2}).SoxFilter("lowpass 120","vol -0.5")
sl_{2} = mixaudio(back_{2}.GetLeftChannel(),back_{2}.GetRightChannel(),0.668,-0.668)
sr_{2} = mixaudio(back_{2}.GetRightChannel(),back_{2}.GetLeftChannel(),0.668,-0.668)
sl_{2} = DelayAudio(sl_{2},0.02)
sr_{2} = DelayAudio(sr_{2},0.02)
</Value>
</Option>
<Option>
<Name>Farina Profile</Name>
<Value>
# Farina/Sursound approach Profile M=L+R, S=L-R, c=0.75, L' = (1-c/4)*M+(1+c/4)*S, C' = c*M, R' = (1-c/4)*M-(1+c/4)*S
# also added with 20ms delay and some attenuation on surround
front_{2} = stereo_{2}.soxfilter("filter 20-20000")
back_{2} = stereo_{2}.soxfilter("filter 100-7000")
fl_{2} = mixaudio(mixaudio(front_{2}.GetLeftChannel(),front_{2}.GetRightChannel(),0.500,0.500),mixaudio(front_{2}.GetLeftChannel(),front_{2}.GetRightChannel(),0.500,-0.500),0.8125,1.1875)
fr_{2} = mixaudio(mixaudio(front_{2}.GetLeftChannel(),front_{2}.GetRightChannel(),0.500,0.500),mixaudio(front_{2}.GetLeftChannel(),front_{2}.GetRightChannel(),0.500,-0.500),0.8125,-1.1875)
cc_{2} = mixaudio(front_{2}.GetRightChannel(),front_{2}.GetLeftChannel,0.375,0.375)
lfe_{2} = ConvertToMono(stereo_{2}).SoxFilter("lowpass 120","vol -0.5")
sl_{2} = mixaudio(back_{2}.GetLeftChannel(),back_{2}.GetRightChannel(),0.668,-0.668)
sr_{2} = mixaudio(back_{2}.GetRightChannel(),back_{2}.GetLeftChannel(),0.668,-0.668)
sl_{2} = DelayAudio(sl_{2},0.02)
sr_{2} = DelayAudio(sr_{2},0.02)
</Value>
</Option>
<Option>
<Name>Multisonic Profile</Name>
<Value>
# Multisonic approach Profile modified with 20ms delay and some attenuation on surround
front_{2} = stereo_{2}.soxfilter("filter 20-20000")
back_{2} = stereo_{2}.soxfilter("filter 100-7000")
fl_{2} = mixaudio(front_{2}.GetLeftChannel(),front_{2}.GetRightChannel(),1,-0.5)
fr_{2} = mixaudio(front_{2}.GetRightChannel(),front_{2}.GetLeftChannel(),1,-0.5)
cc_{2} = mixaudio(front_{2}.GetRightChannel(),front_{2}.GetLeftChannel,0.5,0.5)
lfe_{2} = ConvertToMono(stereo_{2}).SoxFilter("lowpass 120","vol -0.5")
sl_{2} = mixaudio(back_{2}.GetLeftChannel(),back_{2}.GetRightChannel(),0.668,-0.668)
sr_{2} = mixaudio(back_{2}.GetRightChannel(),back_{2}.GetLeftChannel(),0.668,-0.668)
sl_{2} = DelayAudio(sl_{2},0.02)
sr_{2} = DelayAudio(sr_{2},0.02)
</Value>
</Option>
<Option>
<Name>Sound On Sound Profile</Name>
<Value>
# SOS approach Profile with 20ms delay and some attenuation on surround
back_{2} = stereo_{2}.soxfilter("filter 100-7000")
fl_{2} = stereo_{2}.GetLeftChannel()
fr_{2} = stereo_{2}.GetRightChannel()
cc_{2} = mixaudio(stereo_{2}.GetRightChannel(),stereo_{2}.GetLeftChannel,0.5,0.5)
lfe_{2} = ConvertToMono(stereo_{2}).SoxFilter("lowpass 120","vol -0.5")
sl_{2} = mixaudio(back_{2}.GetLeftChannel(),back_{2}.GetRightChannel(),0.668,-0.668)
sr_{2} = mixaudio(back_{2}.GetRightChannel(),back_{2}.GetLeftChannel(),0.668,-0.668)
sl_{2} = DelayAudio(sl_{2},0.02)
sr_{2} = DelayAudio(sr_{2},0.02)
</Value>
</Option>
<ScriptEpilogue>
# Return result
MergeChannels( fl_{2}, fr_{2}, cc_{2}, lfe_{2}, sl_{2}, sr_{2})
ConvertAudioTo16Bit()
</ScriptEpilogue>
</MultiOptionDSP>
</Plugin>
</AudioDSP>
</BeHappy.Extension>
JoeBG
18th February 2006, 05:13
@ dimzon
I took the one from 15.02.2006 from celtic druid, works very good
@ northpole
IŽll try it immediatly
NorthPole
19th February 2006, 00:59
Sorry about so many revision on this upmix extension...
This pretty much finishes what I have been able to come up with so here it is
<?xml version="1.0"?>
<BeHappy.Extension xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://workspaces.gotdotnet.com/behappy">
<AudioDSP UniqueID="9579E57B-2D27-4583-99A4-921718E25B41">
<Plugin>
<MultiOptionDSP Type="BeHappy.Extensions.MultiOptionDSP, BeHappy">
<TitleFormatString>5.1 Upmix - {0}</TitleFormatString>
<ScriptPrologue>
# Store clip in variable
stereo_{2} = convertaudiotofloat(last)
front_{2} = stereo_{2}.soxfilter("filter 20-20000")
back_{2} = stereo_{2}.soxfilter("filter 100-7000")
</ScriptPrologue>
<Option>
<Name>Balanced Center Channel Profile</Name>
<Value>
# Balanced approach L' = (L-R)*0.668 R' = (R-L)*0.668 C' = (L-L')*0.398 + (R-R')*0.398
# Profile for general purposes to use with audio sources that have a wide range of sound content
# Attempts to balance sound levels of L', R' and C' with common mono content in center only
# 20ms delay and -2db attenuation on surround SL' = (L-R)*0.531 SR' = (R-L)*0.531
fl_{2} = mixaudio(front_{2}.GetLeftChannel(),front_{2}.GetRightChannel(),0.668,-0.668)
fr_{2} = mixaudio(front_{2}.GetRightChannel(),front_{2}.GetLeftChannel(),0.668,-0.668)
cc_{2} = mixaudio(mixaudio(front_{2}.GetLeftChannel(),fl_{2},1,-1),mixaudio(front_{2}.GetRightChannel(),fr_{2},1,-1),0.398,0.398)
lfe_{2} = ConvertToMono(stereo_{2}).SoxFilter("lowpass 120","vol -0.500")
sl_{2} = mixaudio(back_{2}.GetLeftChannel(),back_{2}.GetRightChannel(),0.531,-0.531).DelayAudio(0.02)
sr_{2} = mixaudio(back_{2}.GetRightChannel(),back_{2}.GetLeftChannel(),0.531,-0.531).DelayAudio(0.02)
</Value>
</Option>
<Option>
<Name>Decreased Center Channel Profile</Name>
<Value>
# Decreased center approach L' = (L-R)*0.668 R' = (R-L)*0.668 C' = (L-L')*0.224 + (R-R')*0.224
# Profile to use for older movies or videos with mostly mono content.
# Same as balanced approach but with significally reduces C' power
# 20ms delay and -2db attenuation on surround SL' = (L-R)*0.531 SR' = (R-L)*0.531
fl_{2} = mixaudio(front_{2}.GetLeftChannel(),front_{2}.GetRightChannel(),0.668,-0.668)
fr_{2} = mixaudio(front_{2}.GetRightChannel(),front_{2}.GetLeftChannel(),0.668,-0.668)
cc_{2} = mixaudio(mixaudio(front_{2}.GetLeftChannel(),fl_{2},1,-1),mixaudio(front_{2}.GetRightChannel(),fr_{2},1,-1),0.224,0.224)
lfe_{2} = ConvertToMono(stereo_{2}).SoxFilter("lowpass 120","vol -0.596")
sl_{2} = mixaudio(back_{2}.GetLeftChannel(),back_{2}.GetRightChannel(),0.531,-0.531).DelayAudio(0.02)
sr_{2} = mixaudio(back_{2}.GetRightChannel(),back_{2}.GetLeftChannel(),0.531,-0.531).DelayAudio(0.02)
</Value>
</Option>
<Option>
<Name>Increased Center Channel Profile</Name>
<Value>
# Increased center approach L' = (L-R)*0.596 R' = (R-L)*0.596 C' = (L-L')*0.473 + (R-R')*0.473
# Profile to use with audio sources where quieter dialog or lots of loud sound effects.
# Same as balanced approach but with slightly higher C' power and slightly lower L' and R' power
# 20ms delay and -2db attenuation on surround SL' = (L-R)*0.473 SR' = (R-L)*0.473
fl_{2} = mixaudio(front_{2}.GetLeftChannel(),front_{2}.GetRightChannel(),0.596,-0.596)
fr_{2} = mixaudio(front_{2}.GetRightChannel(),front_{2}.GetLeftChannel(),0.596,-0.596)
cc_{2} = mixaudio(mixaudio(front_{2}.GetLeftChannel(),fl_{2},1,-1),mixaudio(front_{2}.GetRightChannel(),fr_{2},1,-1),0.473,0.473)
lfe_{2} = ConvertToMono(stereo_{2}).SoxFilter("lowpass 120","vol -0.473")
sl_{2} = mixaudio(back_{2}.GetLeftChannel(),back_{2}.GetRightChannel(),0.473,-0.473).DelayAudio(0.02)
sr_{2} = mixaudio(back_{2}.GetRightChannel(),back_{2}.GetLeftChannel(),0.473,-0.473).DelayAudio(0.02)
</Value>
</Option>
<Option>
<Name>Gerzen Profile</Name>
<Value>
# Gerzen approach L' = (0.885*L)-(0.115*R) C' = (L+R)*0.4511 R' = (0.885*R)-(0.115*L)
# Modified by adding 20ms delay and some attenuation on surround SL' = (L-R)*0.531 SR' = (R-L)*0.531
fl_{2} = mixaudio(front_{2}.GetLeftChannel(),front_{2}.GetRightChannel(),0.885,-0.115)
fr_{2} = mixaudio(front_{2}.GetRightChannel(),front_{2}.GetLeftChannel(),0.885,-0.115)
cc_{2} = mixaudio(front_{2}.GetRightChannel(),front_{2}.GetLeftChannel,0.4511,0.4511)
lfe_{2} = ConvertToMono(stereo_{2}).SoxFilter("lowpass 120","vol -0.5")
sl_{2} = mixaudio(back_{2}.GetLeftChannel(),back_{2}.GetRightChannel(),0.531,-0.531).DelayAudio(0.02)
sr_{2} = mixaudio(back_{2}.GetRightChannel(),back_{2}.GetLeftChannel(),0.531,-0.531).DelayAudio(0.02)
</Value>
</Option>
<Option>
<Name>Farina Profile</Name>
<Value>
# Farina/Sursound approach M=L+R, S=L-R, c=0.75, L' = (1-c/4)*M+(1+c/4)*S, C' = c*M, R' = (1-c/4)*M-(1+c/4)*S
# Modified by adding 20ms delay and some attenuation on surround SL' = (L-R)*0.562 SR' = (R-L)*0.562
fl_{2} = mixaudio(mixaudio(front_{2}.GetLeftChannel(),front_{2}.GetRightChannel(),0.500,0.500),mixaudio(front_{2}.GetLeftChannel(),front_{2}.GetRightChannel(),0.500,-0.500),0.8125,1.1875)
fr_{2} = mixaudio(mixaudio(front_{2}.GetLeftChannel(),front_{2}.GetRightChannel(),0.500,0.500),mixaudio(front_{2}.GetLeftChannel(),front_{2}.GetRightChannel(),0.500,-0.500),0.8125,-1.1875)
cc_{2} = mixaudio(front_{2}.GetRightChannel(),front_{2}.GetLeftChannel,0.375,0.375)
lfe_{2} = ConvertToMono(stereo_{2}).SoxFilter("lowpass 120","vol -0.5")
sl_{2} = mixaudio(back_{2}.GetLeftChannel(),back_{2}.GetRightChannel(),0.562,-0.562).DelayAudio(0.02)
sr_{2} = mixaudio(back_{2}.GetRightChannel(),back_{2}.GetLeftChannel(),0.562,-0.562).DelayAudio(0.02)
</Value>
</Option>
<Option>
<Name>Multisonic Profile</Name>
<Value>
# Multisonic approach L' = L-(0.5*R) C' = (L+R)*0.5 R' = R-(0.5*L)
# Reduced above formula by 10% to eliminate potential clipping on L' and R'
# Modified by adding 20ms delay and some attenuation on surround SL' = (L-R)*0.596 SR' = (R-L)*0.596
fl_{2} = mixaudio(front_{2}.GetLeftChannel(),front_{2}.GetRightChannel(),0.9,-0.45)
fr_{2} = mixaudio(front_{2}.GetRightChannel(),front_{2}.GetLeftChannel(),0.9,-0.45)
cc_{2} = mixaudio(front_{2}.GetRightChannel(),front_{2}.GetLeftChannel,0.45,0.45)
lfe_{2} = ConvertToMono(stereo_{2}).SoxFilter("lowpass 120","vol -0.5")
sl_{2} = mixaudio(back_{2}.GetLeftChannel(),back_{2}.GetRightChannel(),0.596,-0.596).DelayAudio(0.02)
sr_{2} = mixaudio(back_{2}.GetRightChannel(),back_{2}.GetLeftChannel(),0.596,-0.596).DelayAudio(0.02)
</Value>
</Option>
<ScriptEpilogue>
# Return result
MergeChannels( fl_{2}, fr_{2}, cc_{2}, lfe_{2}, sl_{2}, sr_{2})
ConvertAudioTo16Bit()
</ScriptEpilogue>
</MultiOptionDSP>
</Plugin>
</AudioDSP>
</BeHappy.Extension>
Changes:
- Tweaked most of the surround levels to try and match the particular profile.
- Nuked the sound on sound profile (the last one) because it was just the alot of same sound from the L, R & C (not much channel or dialog separation).
- Changed the names on the first 2 profiles to better explain what they are trying to do.
- Added another profile to increase the center channel levels.
- Added some notes, etc.
Thanks again dimzon for this slick audio convertion tool.
dimzon
19th February 2006, 12:40
@NorthPole
Thanx for Your investigations.
I just wrote a tool, but You and tebasuna51 fill it life
By the way - future of BeHappy
I'm really waitng when MeGUI refacoring done. Probably BeHappy will be assimilated by MeGUI completly (currently it share same code but MeGUI has subset of BeHappy functionality)
JoeBG
19th February 2006, 19:54
@NorthPole
Thanx for Your investigations.
I just wrote a tool, but You and tebasuna51 fill it life
By the way - future of BeHappy
I'm really waitng when MeGUI refacoring done. Probably BeHappy will be assimilated by MeGUI completly (currently it share same code but MeGUI has subset of BeHappy functionality)
Please leave it as a standalone tool :)
dimzon
19th February 2006, 20:29
Please leave it as a standalone tool :)
Why? Why does not combine them with MeGUI (preserving BeHappy functionality/flexibility)
JoeBG
20th February 2006, 20:08
Why? Why does not combine them with MeGUI (preserving BeHappy functionality/flexibility)
OK, this makes sense. :) I just want to be able to use it without MeGUI for quick encoding decisions.
dimzon
1st March 2006, 14:45
The solution is make alternate curves with normalized output. I'm work about this.
Hi! Any progress with it?
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.