Log in

View Full Version : BeHappy - AviSynth based audio transcoding tool (UPD 19-07-2006)


Pages : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 [21] 22 23 24 25 26 27

Reino
10th February 2012, 21:07
tebasuna has already explained in post #995 why this will not work:My apologies.
The working directory will be the one containing the script, not the audio file.Having tak_deco_lib.dll in either directory won't let you decode tak-files. Just tested it.

To summarize the workarounds to decode OptimFROG or TAK that do work:
- put OptimFROG.dll and tak_deco_lib.dll in the app's directory (MPC-HC's directory for instance if you open the Avisynth script with it).
- put OptimFROG.dll and tak_deco_lib.dll in the Windows\System32 directory.
- add the plugins directory to the Windows Environment System Variables, so Windows can search that directory if external libraries are needed and will use them automatically. (Windows key+Pause, "Advanced"-tab, "Environment Variables", "System Variables", click "Path", Edit, at the end add the full path of the plugins directory with a preceding semicolon (';'))
- use tsp's LoadDll Avisynth plugin (http://www.avisynth.org/tsp/LoadDll.zip). Insert LoadDll("path\tak_deco_lib.dll") before Loadplugin("path\BassAudio.dll")!

tebasuna51
11th February 2012, 12:04
...
However, I'm not sure what you (tebasuna) mean by "AviSynth set the working directory to the directory of the sample to decode". The working directory will be the one containing the script, not the audio file.

You are rigth, maybe I simplified the explain because the problem is the same, to have the ext dll's in .avs directory or sample file directory don't help CoRoNe requirements.

With my test with wavi and a .avs file, work fine with a ext-dll copy in "plugins" directory and other in .avs directory or in sample file directory.

And using BeHappy the .avs is created in a temp user directory (GetTempPath), under user Documents and Settigns, more difficult to use than sample directory.

BTW, I edit my previous post to be more exact.

Reino
15th February 2012, 14:00
I'm resigning myself with this issue. LoadDll it's gonna be until someday perhaps bass_ofr.dll and bass_tak.dll will search for external Dlls in the plugins directory first.

Something completely different now...

In the past I've always used BeSweet in combination with BeLight to do 5.1 AC3 to DPLII <audio-format> conversions. Lately I've been experimenting with Foobar, foo_input_avs (to load Avisynth scripts) and several DSPs, but I wasn't satisfied with the results. Before Foobar I already knew BeHappy could do the same thing more or less, but yesterday I really dug into it;

I noticed BeHappy uses another DPLII matrix (http://forum.doom9.org/showthread.php?p=1464705#post1464705), compared to the official one (https://en.wikipedia.org/wiki/Matrix_decoder#Dolby_Pro_Logic_II_matrix_encoding_.282:5.29), which has been discussed here (http://forum.doom9.org/showthread.php?t=105869) amongst other threads.
Now if I understand correctly how to derive a DPLII matrix's coefficients (http://forum.doom9.org/showthread.php?p=145721#post145721), and I did my calculations correctly in the draft below, those numbers have to correspond with the official DPLII matrix, don't they?

Draft with calculations I made in notepad yesterday:
BeHappy DPL2 matrix:
Lt = 1.0L + 0.7071(√½)*C + 0.8660(√¾)*Ls + 0.5000(√¼)*Rs 1 + 0.7071 + 0.8660 + 0.5000 = 3.0731
Rt = 1.0R + 0.7071(√½)*C - 0.5000(√¼)*Ls - 0.8660(√¾)*Rs 1 / 3.0731 = 0.3254

function Dmix6Dpl2(clip a) {
flr = GetChannel(a, 1, 2)
fcc = GetChannel(a, 3, 3)
lrc = MixAudio(flr, fcc, 0.3254, 0.2301) 0.3254, (0.3254*0.7071)
bl = GetChannel(a, 5)
br = GetChannel(a, 6)
sl = MixAudio(bl, br, 0.2818, 0.1627) (0.3254* 0.8660), (0.3254* 0.5000)
sr = MixAudio(bl, br, -0.1627, -0.2818) (0.3254*-0.5000), (0.3254*-0.8660)
blr = MergeChannels(sl, sr)
return MixAudio(lrc, blr, 1.0, 1.0)
}
=====================================================================================================
Official DPL2 matrix:
Lt = 1.0L + 0.7071(√½)*C - 0.8165(√⅔)*Ls - 0.5774(√⅓)*Rs 1 + 0.7071 + 0.8165 + 0.5774 = 3.1010
Rt = 1.0R + 0.7071(√½)*C + 0.5774(√⅓)*Ls + 0.8165(√⅔)*Rs 1 / 3.1010 = 0.3225

function Dmix6Dpl2(clip a) {
flr = GetChannel(a, 1, 2)
fcc = GetChannel(a, 3, 3)
lrc = MixAudio(flr, fcc, 0.3225, 0.2280) 0.3225, (0.3225*0.7071)
bl = GetChannel(a, 5)
br = GetChannel(a, 6)
sl = MixAudio(bl, br, -0.2633, -0.1862) (0.3225*-0.8165), (0.3225*-0.5774)
sr = MixAudio(bl, br, 0.1862, 0.2633) (0.3225* 0.5774), (0.3225* 0.8165)
blr = MergeChannels(sl, sr)
return MixAudio(lrc, blr, 1.0, 1.0)
}
=======================================================================================================================
Official DPL2+LFE matrix:
Lt = 1.0L + 0.7071(√½)*C + 0.7071(√½)*LFE - 0.8165(√⅔)*Ls - 0.5774(√⅓)*Rs 1 + 2*0.7071 + 0.8165 + 0.5774 = 3.8081
Rt = 1.0R + 0.7071(√½)*C + 0.7071(√½)*LFE + 0.5774(√⅓)*Ls + 0.8165(√⅔)*Rs 1 / 3.8081 = 0.2626

function Dmix6Dpl2Lfe(clip a) {
flr = GetChannel(a, 1, 2)
fcc = GetChannel(a, 3, 3)
lrc = MixAudio(flr, fcc, 0.2626, 0.1857) 0.2626, (0.2626*0.7071)
lfe = GetChannel(a, 4, 4)
lrc = MixAudio(lrc, lfe, 1.0, 0.1857) (0.2626*0.7071)
bl = GetChannel(a, 5)
br = GetChannel(a, 6)
sl = MixAudio(bl, br, -0.2144, -0.1516) (0.2626*-0.8165), (0.2626*-0.5774)
sr = MixAudio(bl, br, 0.1516, 0.2144) (0.2626* 0.5774), (0.2626* 0.8165)
blr = MergeChannels(sl, sr)
return MixAudio(lrc, blr, 1.0, 1.0)
}

Now, as I'm unsatisfied with Foobar's Dynamics Compressor, I'd like to do BeSweet.exe -azid(-s dplii -c normal -L -3db --maximize) -ota(-hybridgain) (which I've been using a lot in the past if I remember correctly) with Avisynth. Please tell me, am I getting close?:
NicDTSSource("FileName.dts", DRC=1) # -azid(-c normal)
ConvertAudioToFloat()

flr = GetChannel(1, 2)
fc = GetChannel(3, 3)
lrc = MixAudio(flr, fc, 0.2626, 0.1857)
lfe = GetChannel(4, 4)
lrc = MixAudio(lrc, lfe, 1.0, 0.1857)
-----------------------------------------
lfe = GetChannel(4, 4).AmplifydB(-3.0) # -azid(-L -3db), or would this totally screw-up the DPLII-matrix?
lrc = MixAudio(lrc, lfe, 1.0, 1.0)
-----------------------------------------
bl = GetChannel(5)
br = GetChannel(6)
sl = MixAudio(bl, br, -0.2144, -0.1516)
sr = MixAudio(bl, br, 0.1516, 0.2144)
blr = MergeChannels(sl, sr)
MixAudio(lrc, blr, 1.0, 1.0) # -azid(-s dplii)

Normalize() # -azid(--maximize)
AmplifydB(10) # -ota(hybridgain), I just picked a number (dB), because I don't
# know what would be equivalent to hybridgain.

P.s. Although I believe this (https://en.wikipedia.org/wiki/Matrix_decoder#Dolby_Pro_Logic_II_matrix_encoding_.282:5.29) is the official DPLII matrix, it's strange this (https://en.wikipedia.org/wiki/Dolby_Pro_Logic#Dolby_encoding_matrices) one is also mentioned on wikipedia...

tebasuna51
16th February 2012, 01:54
I'd like to do BeSweet.exe -azid(-s dplii -c normal -L -3db --maximize) -ota(-hybridgain) with Avisynth.

Here -hybridgain do nothing because the audio was already normalized by azid parameter --maximize.

Please tell me, am I getting close?:
...
lfe = GetChannel(4, 4)
lrc = MixAudio(lrc, lfe, 1.0, 0.1857)
-----------------------------------------
lfe = GetChannel(4, 4).AmplifydB(-3.0) # -azid(-L -3db), or would this totally screw-up the DPLII-matrix?
lrc = MixAudio(lrc, lfe, 1.0, 1.0)
-----------------------------------------

You can't add two times LFE, the first one is enough to complain -azid(-L -3db)


...
Normalize() # -azid(--maximize)
AmplifydB(10) # -ota(hybridgain), I just picked a number (dB), because I don't
# know what would be equivalent to hybridgain.

Like I say before -ota(hybridgain) do nothing with a normalized audio. With this syntax you clip all sound over -10 dB and distort the output.

Reino
16th February 2012, 13:01
It was only just a draft, not heeding the syntax that much. Perhaps I should've put brackets in front of it, because obviously I didn't mean to invoke both LFE lines at the same time:
lfe = GetChannel(4, 4)
lrc = MixAudio(lrc, lfe, 1.0, 0.1857)
#-----------------------------------------
#lfe = GetChannel(4, 4).AmplifydB(-3.0) # -azid(-L -3db), or would this totally screw-up the DPLII-matrix?
#lrc = MixAudio(lrc, lfe, 1.0, 1.0)
#-----------------------------------------But if you say, -azid(-L -3dB) is already incorporated in the matrix, then I'll just delete the line of course.

Strange, as far as I can remember, there was a guide years ago, that recommended that specific BeSweet command-line, and a lot of people used that guide. Strange then, because I can indeed confirm it doesn't do anything (filesize stays the same) when I remove -ota(hybridgain) from BeSweet's command-line. In that case, I think it's save to use the following script for AC3 audio then:
NicAC3Source("FileName.ac3", DRC=1) NicDTSSource("FileName.dts", DRC=1) # -azid(-c normal)
ConvertAudioToFloat() ConvertAudioToFloat()

flr = GetChannel(a, 1, 2) flr = GetChannel(a, 1, 2)
fc = GetChannel(a, 3, 3) fc = GetChannel(a, 3, 3)
lrc = MixAudio(flr, fc, 0.2626, 0.1857) lrc = MixAudio(flr, fc, 0.2626, 0.1857)
lfe = GetChannel(a, 4, 4) lfe = GetChannel(a, 4, 4)
lrc = MixAudio(lrc, lfe, 1.0, 0.1857) lrc = MixAudio(lrc, lfe, 1.0, 0.1857) # -azid(-L -3db)
bl = GetChannel(a, 5) bl = GetChannel(a, 5)
br = GetChannel(a, 6) br = GetChannel(a, 6)
sl = MixAudio(bl, br, -0.2144, -0.1516) sl = MixAudio(bl, br, 0.2144, 0.1516) # Phase Shift for DTS(?)
sr = MixAudio(bl, br, 0.1516, 0.2144) sr = MixAudio(bl, br, -0.1516, -0.2144)
blr = MergeChannels(sl, sr) blr = MergeChannels(sl, sr)
MixAudio(lrc, blr, 1.0, 1.0) MixAudio(lrc, blr, 1.0, 1.0) # -azid(-s dplii)

Normalize() Normalize() # -azid(--maximize)http://www.ld-host.de/uploads/thumbnails/5eb323c177234a06887e6879e2816c3f.png (http://www.ld-host.de/show/5eb323c177234a06887e6879e2816c3f.png)
(Foobar Downmix AC3/DTS to DPL2 plugin)
And what about 90° Phase Shifting for DTS audio? I noticed BeHappy uses the same matrix for AC3 and DTS, but shouldn't I apply the code above to DTS audio, or is this completely wrong and unnecessary?

P.s. I assume my matrix calculations earlier were correct :p

tebasuna51
17th February 2012, 05:00
- You don't need ConvertAudioToFloat(), The output from NicAc3/DtsSource is already float.

- Dolby don't recommend use LFE in DPL II

- I don't recommend use Phase Shift with encoded data source (even DTS). Change the signs is not equivalent to use Phase Shift.
I don't know any AviSynth function to change audio phase.

- You are free to try any downmix that you want. But if you ask me the correct downmix matrix is the included already in BeHappy.

Reino
17th February 2012, 18:11
AudioDub(Blankclip(),NicDtsSource("test.dts"))
b = (IsAudioFloat==true) ? String(" float") : String(" int")
Subtitle(String(AudioBits) + "bit" + b)
- "32bit float" indeed. :p Didn't know that.

- I've read about it, yes. Though I believe everyone does it anyway, right?

- BeSweet doesn't have PhaseShift settings either I believe. It's only the Downmix AC3/DTS to DPL2 plugin for Foobar, so I guess it's not that important.

- I'll certainly give it a try.
Btw, I just came to realize; you mentioned "downmix matrix"...

Lt = 1.0*L + 0.7071*C + 0.7071*LFE - 0.8165*Ls - 0.5774*Rs
Rt = 1.0*R + 0.7071*C + 0.7071*LFE + 0.5774*Ls + 0.8165*Rs

Lt = 0.2626*L + 0.1857*C + 0.1857*LFE - 0.2144*Ls - 0.1516*Rs
Rt = 0.2626*R + 0.1857*C + 0.1857*LFE + 0.1516*Ls + 0.2144*Rs

Then the first one is probably called "upmix matrix"?

======================================================

Something different (again)...
Yesterday I noticed that for PAL,NTSC conversions BeHappy uses (AudioRate()*1001+480)/960) instead of the imo more obvious (AudioRate()*1001/24000)*25), so I (again) did some testing:
#NicDtsSource("test.dts") #48000Hz 6ch 1536kbps, 32bit float | NTSC->PAL, 2:00.075s->1:55.157s

#AssumeSampleRate(last, (AudioRate()*1001/24000)*25).SSRC(AudioRate(last)) #48000->50050.0000 | 50050 (1:55.157s)
#AssumeSampleRate(last, (AudioRate()*1001+480)/960).SSRC(AudioRate(last)) #48000->50050.5000 | 50050 (1:55.157s)


#NicAc3Source("test.ac3") #48000Hz 6ch 448kbps, 32bit float | PAL->NTSC, 2:00.000s->2:05.125s

#SSRC(last, (AudioRate()*1001/24000)*25).AssumeSampleRate(AudioRate(last)) #48000->50050.0000 | 50050 (2:05.125s)
#SSRC(last, (AudioRate()*1001+480)/960).AssumeSampleRate(AudioRate(last)) #48000->50050.5000 | 50050 (2:05.125s)


#WavSource("test_dts.wav") #44100Hz 2ch 1411kbps, 16bit int | NTSC->PAL, 2:00.075s->1:55.157s

#AssumeSampleRate(last, (AudioRate()*1001/24000)*25).SSRC(AudioRate(last)) #44100->45983.4375 | 45975 (1:55.178s)
#AssumeSampleRate(last, (AudioRate()*1001+480)/960).SSRC(AudioRate(last)) #44100->45983.9375 | 45983 (1:55.158s)


WavSource("test_ac3.wav") #44100Hz 2ch 1411kbps, 16bit int | PAL->NTSC, 2:00.000s->2:05.125s ¹
ConvertAudioToFloat()
#SSRC(last, (AudioRate()*1001/24000)*25).AssumeSampleRate(AudioRate(last)) #44100->45983.4375 ² | 45975 (2:05.102s) ³
SSRC(last, (AudioRate()*1001+480)/960).AssumeSampleRate(AudioRate(last)) #44100->45983.9375 | 45983 (2:05.124s)
¹ <original length> -> <length it should be after conversion>
² <original frequency> -> <frequency it should be after conversion, without SSRC()>
³ <reported frequency> <reported length> (by Foobar and foo_input_avs)

Both formulas produce the same result for DTS and AC3, but for 44.1kHz 2ch 1411kbps WAV it's a whole different story!
Both aren't millisecond accurate, not even (AudioRate()*1001+480)/960), but I really don't understand the reported 45975Hz in the first place! At first I thought the 16bit int could be the reason, but inserting a ConvertAudioToFloat() didn't make a difference.
Is this some Avisynth shortcoming? And if so, how did you even come up with (AudioRate()*1001+480)/960)?!

tebasuna51
17th February 2012, 20:15
Then the first one is probably called "upmix matrix"?

Both are "downmix matrix" -> the output have less channels than input.

The first one is a "not-normalized" matrix and the second one is a "normalized" matrix (the output can't have values greater than 1.0)

If you use float values, and after normalize, you can use both.
But the function must work also with integer values, then you need use the "normalized matrix" to avoid clip.

And if so, how did you even come up with (AudioRate()*1001+480)/960)?!

The SSRC function only support integer values, then the operations are truncatted to int values.

Like: 25/ (24000/1001) = 1001 * (25/24000)= 1001 * (1/960) = 1001/960

Is more exact let the division to last operation, (instead multiply the error by 25):

(AudioRate()*1001)/960

And the '+ 480' factor (480/960 = 0.5) is to round to the next integer
int(45983.4 +0.5) -> 45983
int(45983.6 +0.5) -> 45984

For instance:

(44100*1001/24000)*25 = (1839) * 25 = 45975
far of 45983.4375

(44100*1001+480)/960 = 45983
near to 45983.4375

Reino
17th February 2012, 21:49
Ah, mathematics. Nice! I understand now.

I realized not only SSRC is integer only, but AudioRate() and AssumeSampleRate() as well and that's why ConvertAudioToFloat() wouldn't make a difference.
With 48000Hz is just so happens to be all integer...

AudioRate(48000*1001/24000=2002) --> AssumeSampleRate(2002*25=50050)

...unlike 44100, where the truncation already begins with AudioRate()...

AudioRate(44100*1001/24000=1839.3375) --> AssumeSampleRate(1839*25=45975)

While with (AudioRate()*1001+480)/960) the truncation is 1 step later...

AudioRate(48000*1001+480=48048480) --> AssumeSampleRate(48048480/960=50050.50) --> 50050

...and...

AudioRate(44100*1001+480=44144580) --> AssumeSampleRate(44144580/960=45983.9375) --> 45983

Ingenious, really! :p Thanks for all the info, tebasuna51! :goodpost:

kolak
17th February 2012, 23:07
Is it possible to add generic (numbered) files/channels naming in wavsplit:

audio_1
audio_2
audio_3

etc

instead of

audio_L
audio_R
audio_C
...


Thanks

tebasuna51
18th February 2012, 04:31
Is possible but I don't like the idea.

EDIT: This is a modified version:

kolak
18th February 2012, 14:53
:thanks::thanks:

Could wavsplit extract wav directly from AVI or do I have to always use BeHAppy for this?

tebasuna51
18th February 2012, 20:26
wavsplit can't extract audio from avi.

BeHappy can' extract wav from avi, but can decode any audio from avi using DirectShowSource/AviSource

kolak
18th February 2012, 20:47
wavsplit can't extract audio from avi.

BeHappy can' extract wav from avi, but can decode any audio from avi using DirectShowSource/AviSource

Yes- that's what I'm using now- directshow source as it's 8 channels 24bit wav- so mostly >4GB. Only this works.

Xplorer4x4
7th July 2012, 10:32
Has any one managed to get BeHappy working under Wine? If so can any one tell me or link me to an explanation of how they did it?

LigH
27th July 2012, 21:39
There is now also an Opus plugin (http://www.un4seen.com/forum/?topic=13870.0) for BassAudio.

Thanks to CoRoNe on HydrogenAudio for telling me.

Reino
9th August 2012, 21:39
tebasuna51, could you please have a look at BassAudio in combination with the latest Bass 2.4.9.0? Somehow the libraries aren't unloaded/killed upon exit, because MPC-HC (which I always use for *.avs) remains active in the background (task manager)! Or just close the file (Ctrl+C) in MPC-HC and it will freeze. This was not the case with Bass 2.4.8.1.

And could you check if it all still works in Foobar (foo_input_avs)? I'm still facing all the before mentioned issues, but with Bass 2.4.9.0 Foobar completely hangs upon dragging an avs-file into the playlist. This happens even only with bass.dll.


I still don't understand why I can't use BassAudio with foo_input_avs...
- Anything but BassAudio (like NicAC3Source or WavSource) works fine in Foobar.
- Dragging an avs-file with BassAudioSource(wav/aiff/mp3/mp2/mp1/ogg) into Foobar results in a big crash; Application Error. The instruction at "0x084107f1" referenced memory at "0x084107f1".
- Dragging an avs-file with BassAudioSource(aac/flac/wv/tak), any format that requires a bass_xxx.dll, into Foobar doesn't make it crash, but it simply won't load.
I can't believe I'm the only one having this issue with Foobar.

tebasuna51
10th August 2012, 14:02
Yes, seems the last Bass.dll version 2.4.9 don't work at all with the interface to AviSynth BassAudio.dll.
We need remain with 2.4.8 version.

And BassAudio works for me with Foobar2000.

Reino
10th August 2012, 17:46
You can't update BassAudio to make it work with Bass 2.4.9.0?

tebasuna51
11th August 2012, 09:21
With big version changes (2.2 -> 2.3 -> 2.4) there are info than help me to change BassAudio.dll, but this change (2.4.8 -> 2.4.9) don't have the needed info, maybe is a bug, or I need wait until a new big change (2.4 -> 2.5), or never can change BassAudio to be compatible (with my poor knowledge of course, the source is open and included with BeHappy if you want try).

Sorry.

Reino
12th August 2012, 13:16
No problem, it's not urgent or anything.

But uh,...another question:
I wanted to see if the foo_input_avs-issues I face on my WinXP machine, would also bring me headaches on a Win7 laptop (of a friend), but I just can't get BassAudio to work.
LoadPlugin: unable to load: "<path>\BassAudio.dll", error=0x7e
Now, the only related post I could find it this one:
The 0x7e error indicates that one or more dependent dlls are missing from the system.

make sure you have the Visual Studio 2010 runtime (http://www.microsoft.com/download/en/details.aspx?id=5555) installed, as the plugin requires it.
Installing that one, nor the 1st servicepack made a difference. .NET Framework 2, 3 and 3.5 are not compatible with Win7, but installing .NET Framework 4 wasn't rewarding either.
Do you have any idea what I'm doing wrong and how to get BassAudio.dll working on Win7?

tebasuna51
12th August 2012, 19:10
BassAudio.dll (v2.4 2008) was compiled with Visual C++ Express 2005.

I make a new compile with Visual C++ Express 2010, with a more recent version of AviSynth.h and the last Bass.h (with Bass.dll 2.4.9).
Work for me (XP SP3) with Bass.dll 2.4.8 but still not work with 2.4.9

I can't test W 7. Please see if there are any difference with previous version.

Reino
12th August 2012, 20:42
Thanks. Once I get a hold of my friend's laptop I'll let you know.

Reino
18th August 2012, 16:49
Okay, earlier this week I've used a family member's Win7 laptop and everything went fine with MPC-HC and Foobar.
Yesterday I had the chance to test BassAudio on my friends Win7 laptop again, but surprisingly everything went fine too. I guess I made some mistakes last time. The old BassAudio.dll as well as the new one worked fine. After that I even quickly installed Avisynth and Foobar on my mother's old WinXP laptop, but even that one could play it all.
Now that was really frustrating! Eventually I even monitored Foobar's every single move on my computer with Sysinternals Process Monitor, in the hope I could find an answer for the issue I faced. But then I suddenly realized; I had been using Foobar 1.1.14-b3 to test BassAudio on the other computers while my own computer still had 1.1.10 installed. And what'd you know, after updating to 1.1.14 yesterday I could suddenly open all bass_xx.dll audio formats in Foobar! Not my computer, not BassAudio and neither foo_input_avs is to blame, but me still using an old version of Foobar... http://www.hydrogenaudio.org/forums/style_emoticons/default/headbang.gif
Everything is fine now. Sorry for the trouble, tebasuna51.

Mackan
30th December 2012, 11:10
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>

Sorry to quote this whole thing, from a long time ago. But I had a look at the Sox compand function for your Film Standard DRC, and it seems to me that it doesn't produce the expected DRC curve from Dolby. I did a plot of it with gnuplot, from Sox.

I tried to modify it to make it look like the expected curve, and this one did seemed to do the trick.

Film Standard:

compand 0.1,0.3 -90,-84,-43,-37,-31,-31,-26,-26,-16,-21,0,-20.25 0 0 0.1

I don't know why Dolby mentions the final cut range to go from 16dB... to +4dB in their documents, since 0 dBFS is our limit to work with. Also, the dial norm of -31dB doesn't seem to be symmetric in the the null band for this DRC profile, while for Film Light it is. That's something I also don't understand.

Maybe you have a comment on this, after all these years? ;)

Reino
7th April 2013, 17:41
Yes, seems the last Bass.dll version 2.4.9 don't work at all with the interface to AviSynth BassAudio.dll.
We need remain with 2.4.8 version.What about BASS 2.4.10?

Could you let the next BassAudio version accept original BASS add-on filenames? At the moment it seems BassAudio only accepts BASS add-ons with an underscore in their filename (bass_xxx.dll, like the 3th-party add-ons). BASS' own add-ons; basswma, basscd, bassflac, basswv and bassopus, don't have an underscore in their original filename. You'd have to add one manualy for BassAudio to work.

Jenyok
7th April 2013, 19:21
tebasuna51
.
Where could I find algorithm "A real time audio upmixing method from stereo to 7.1 channel audio" ?
Discription of this algorithm.
.
Thanks.
.

tebasuna51
7th April 2013, 20:06
What about BASS 2.4.10?

Still untested. Work for you?

Could you let the next BassAudio version accept original BASS add-on filenames?
...
You'd have to add one manualy for BassAudio to work.

Maybe in next version. But is really easy, or not?

Where could I find algorithm "A real time audio upmixing method from stereo to 7.1 channel audio"?
Sorry I don't know.
Maybe is better use receivers DSP's to do this job.

Jenyok
8th April 2013, 06:18
tebasuna51
.
One more question to you.
.
What string parameters in SoxFilter(...) function for AVISynth could I use to achive following result "Concert Hall Light, No combine sourse Left аnd Right" ?
.
Thanks.
.

tebasuna51
8th April 2013, 12:58
What is "Concert Hall Light, No combine sourse Left аnd Right"?
A DSP function of a receiver?

Sorry but I can't help you with your questions.

Jenyok
8th April 2013, 13:18
New improvments and changes.
.
There are some functions to convert MONO audio signal to PSEUDO STEREO.
There are some functions to convert STEREO audio signal to 5.1 audio signal.
Added new functions to script.
.
Version 1.5 .
.
See description in code section.
See attached RAR file.
.

#
# File: Stereo.avsi
#
#
# Date: 08.04.2013 year
# Version: 1.5
#
#
# License: GNU GENERAL PUBLIC LICENSE
#
#
# Author: Jenyok (Evgeniy Gurovskikh, Russia, Moscow)
# E-Mail: e_gurovskikh@mail.ru
#
#
# Functions (pseudo Stereo and other sound functions) for AVISynth
#
# For all occasions of life (На все случаи жизни) ...
#
#
# Plugin and Import
#
# SoxFilter.dll
#
#
#
# function GetLeftChannel(clip clp)
# function GetRightChannel(clip clp)
# function Phase180(clip clp)
#
#
# function PhaseDelay(clip clp, float "freq", float "phi") Shift (rotate) phase of audio to a different angle
# function PhaseShift(clip clp, float "freq", float "phi") Shift (rotate) phase of audio to a different angle
# function PhaseShift2(clip clp, float "freq", float "freq2", float "phi") Shift (rotate) phase of audio to a different angle
#
# function MonoToStereo(clip clp) Convert MONO audio to STEREO audio
# function PseudoStereo1(clip clp, int "Channel", float "Delay") Only DELAY between channels, Delay in Sec
# function PseudoStereo12(clip clp, int "Channel", float "Delay", float "KMix") DELAY, L=L*k1+R*k2, R=R*k1+L*k2 (Addition)
# function PseudoStereo13(clip clp, int "Channel", float "Delay", float "KMix") DELAY, L=L*k1-R*k2, R=R*k1-L*k2 (Substraction)
#
# function PseudoStereo2(clip clp, int "Channel", float "LowFreq", float "HighFreq", bool "isDelay")
#
# function PseudoStereo3(clip clp, int "Channel", bool "isDelay") Described: Magazine "Radio" № 6, 1985 year, page 62 (USSR, Russia)
# function PseudoStereo33(clip clp, int "Channel", bool "isDelay") Described: Magazine "Radio" № 6, 1985 year, page 62 (USSR, Russia)
#
# function PseudoStereo4(clip clp, int "Channel", bool "isDelay") US Patent No 6,636,608 B1
# function PseudoStereo43(clip clp, int "Channel", bool "isDelay") US Patent No 6,636,608 B1
#
# function PseudoStereo5(clip clp, int "Channel", bool "isDelay") Analog: Philips chip TDA3810 (sound porcessor)
# function PseudoStereo52(clip clp, int "Channel", bool "isDelay") Analog: Philips chip TDA3810 (sound porcessor)
#
#
# function StereoEnhancer(clip clp) Analog: Philips chip TDA3810 (sound porcessor)
#
#
# function StereoTo51(clip clp, bool "is24bit", bool "isStereo") Convert STEREO to 5.1 audio, 24 bits output
#
# function UpDialog(clip clp) Convert STEREO to 5.1 audio
# function UpDialog2(clip clp) Convert STEREO to 5.1 audio
# function UpAction(clip clp) Convert STEREO to 5.1 audio
# function UpAction2(clip clp) Convert STEREO to 5.1 audio
# function UpGerzen(clip clp) Convert STEREO to 5.1 audio
# function UpFarina(clip clp) Convert STEREO to 5.1 audio
# function UpMultisonic(clip clp) Convert STEREO to 5.1 audio
# function UpSoundOnSound(clip clp) Convert STEREO to 5.1 audio
#
#
# function Dmix3Stereo(clip a) Downmix sound functions
# function Dmix3Dpl(clip a) Downmix sound functions
# function Dmix4lStereo(clip a) Downmix sound functions
# function Dmix4qStereo(clip a) Downmix sound functions
# function Dmix4sDpl(clip a) Downmix sound functions
# function Dmix5Stereo(clip a) Downmix sound functions
# function Dmix5Dpl(clip a) Downmix sound functions
# function Dmix5Dpl2(clip a) Downmix sound functions
# function Dmix6Stereo(clip a) Downmix sound functions
# function Dmix6Dpl(clip a) Downmix sound functions
# function Dmix6Dpl2(clip a) Downmix sound functions
# function Dmix6StereoLfe(clip a) Downmix sound functions
# function Dmix6StereoLfe2(clip a) Downmix sound functions
# function Dmix6DplLfe(clip a) Downmix sound functions
# function Dmix6Dpl2Lfe(clip a) Downmix sound functions
#
#

.

LigH
9th April 2013, 07:47
@ tebasuna51:

"Concert Hall" is probably a reverb model. There is a brief explanation in a webpage about a Lexicon reverb filter (http://www.lexiconpro.com/en/products/pcm-native-concert-hall-reverb). I don't know if there is any kind of parametrical implementation; modern reverb filters will probably use "convolution" impulse response models (applying the recorded echo of a sharp impulse in a real sample room to the input sound).

Jenyok
10th April 2013, 14:32
New improvments and changes.
.
There are some functions to convert MONO audio signal to PSEUDO STEREO.
There are some functions to convert STEREO audio signal to 5.1 audio signal.
Added new functions to script.
.
Version 1.6 .
.
See description in code section.
See attached RAR file.
.

#
# File: Stereo.avsi
#
#
# Date: 10.04.2013 year
# Version: 1.6
#
#
# License: GNU GENERAL PUBLIC LICENSE
#
#
# Author: Jenyok (Evgeniy Gurovskikh, Russia, Moscow)
# E-Mail: e_gurovskikh@mail.ru
#
#
# Functions (pseudo Stereo and other sound functions) for AVISynth
#
# For all occasions of life (На все случаи жизни) ...
#
#
# Plugin and Import
#
# SoxFilter.dll
#
#
#
# function GetLeftChannel(clip clp)
# function GetRightChannel(clip clp)
# function Phase180(clip clp)
#
#
# function PhaseDelay(clip clp, float "freq", float "phi") Shift (rotate) phase of audio to a different angle
# function PhaseShift(clip clp, float "freq", float "phi") Shift (rotate) phase of audio to a different angle
# function PhaseShift2(clip clp, float "freq", float "freq2", float "phi") Shift (rotate) phase of audio to a different angle
#
# function MonoToStereo(clip clp, int "Channel") Simple convert MONO audio to STEREO audio
# function PseudoStereo1(clip clp, int "Channel", float "Delay") Only DELAY between channels, Delay in Sec
# function PseudoStereo12(clip clp, int "Channel", float "Delay", float "KMix") DELAY, L=L*k1+R*k2, R=R*k1+L*k2 (Addition)
# function PseudoStereo13(clip clp, int "Channel", float "Delay", float "KMix") DELAY, L=L*k1-R*k2, R=R*k1-L*k2 (Substraction)
#
# function PseudoStereo2(clip clp, int "Channel", float "LowFreq", float "HighFreq", bool "isDelay")
# function PseudoStereo22(clip clp, int "Channel", bool "isDelay")
# function PseudoStereo23(clip clp, int "Channel", bool "isDelay")
#
# function PseudoStereo3(clip clp, int "Channel", bool "isDelay") Described: Magazine "Radio" № 6, 1985 year, page 62 (USSR, Russia)
# function PseudoStereo33(clip clp, int "Channel", bool "isDelay") Described: Magazine "Radio" № 6, 1985 year, page 62 (USSR, Russia)
#
# function PseudoStereo4(clip clp, int "Channel", bool "isDelay") US Patent No 6,636,608 B1
# function PseudoStereo43(clip clp, int "Channel", bool "isDelay") US Patent No 6,636,608 B1
#
# function PseudoStereo5(clip clp, int "Channel", bool "isDelay") Analog: Philips chip TDA3810 (sound porcessor)
# function PseudoStereo52(clip clp, int "Channel", bool "isDelay") Analog: Philips chip TDA3810 (sound porcessor)
#
#
# function StereoEnhancer(clip clp) Analog: Philips chip TDA3810 (sound porcessor)
#
#
# function StereoTo51(clip clp, bool "is24bit", bool "isStereo") Convert STEREO to 5.1 audio, 24 bits output
#
# function UpDialog(clip clp) Convert STEREO to 5.1 audio
# function UpDialog2(clip clp) Convert STEREO to 5.1 audio
# function UpAction(clip clp) Convert STEREO to 5.1 audio
# function UpAction2(clip clp) Convert STEREO to 5.1 audio
# function UpGerzen(clip clp) Convert STEREO to 5.1 audio
# function UpFarina(clip clp) Convert STEREO to 5.1 audio
# function UpMultisonic(clip clp) Convert STEREO to 5.1 audio
# function UpSoundOnSound(clip clp) Convert STEREO to 5.1 audio
#
#
# function Dmix3Stereo(clip a) Downmix sound functions
# function Dmix3Dpl(clip a) Downmix sound functions
# function Dmix4lStereo(clip a) Downmix sound functions
# function Dmix4qStereo(clip a) Downmix sound functions
# function Dmix4sDpl(clip a) Downmix sound functions
# function Dmix5Stereo(clip a) Downmix sound functions
# function Dmix5Dpl(clip a) Downmix sound functions
# function Dmix5Dpl2(clip a) Downmix sound functions
# function Dmix6Stereo(clip a) Downmix sound functions
# function Dmix6Dpl(clip a) Downmix sound functions
# function Dmix6Dpl2(clip a) Downmix sound functions
# function Dmix6StereoLfe(clip a) Downmix sound functions
# function Dmix6StereoLfe2(clip a) Downmix sound functions
# function Dmix6DplLfe(clip a) Downmix sound functions
# function Dmix6Dpl2Lfe(clip a) Downmix sound functions
#
#

.

tebasuna51
13th April 2013, 11:24
See my opinion about 2.0 -> 5.1 conversions in this post (http://forum.doom9.org/showthread.php?p=1623979#post1623979).

XeoneR
23rd May 2013, 22:21
One of the greatest tool ever..

Any chance of the opus support?

LigH
24th May 2013, 07:26
Yes, there is an Opus plugin supported in BASS. Getting it supported in the AviSynth BassAudio plugin has been discussed already, I am just not sure if here or in the HydrogenAudio forum...

tebasuna51
24th May 2013, 15:55
Yes, to decode a opus file you need download bassopus.dll from http://www.un4seen.com/ , rename it to bass_opus.dll and put it with BassAudio.dll and Bass.dll suplied with BeHappy at the default AviSynth-plugin folder.

Richard1485
6th November 2013, 22:22
Behappy appears unable to downmix AC-3 4.0 to 2.0 with NicAC3Source(). It attempts to downmix it as if were a six-channel mix and uses GetChannel() on non-existent channels.

tebasuna51
8th November 2013, 00:26
BeHappy have only a few pre-definned downmix functions, see DownMix.extension.

The users can modify DownMix.extension or load the .avs than make the correct downmix.

Kempy72
26th November 2013, 02:29
link (http://www.openurls.org/)

LigH
4th January 2014, 14:53
As far as I can read the sources, not really being a C coder (m2audio_lpcm.cpp / m2audio_rawav.cpp):

"NicLPCMSource" is for headerless integer PCM audio which requires all attributes explicitly; Motorola (Big Endian) order – as usual for DVD and Blu-ray PCM – is supported by negative sample bits, it may also support the (4LSB-interleaved) 20-bit sample format in DVD Video LPCM streams.

"RaWavSource" is for uncompressed intel (Litte Endian) integer and IEEE float PCM content in WAV and W64 container, it contains a RIFF / RF64 chunk parser.

Wilbert
5th January 2014, 13:55
Yes i saw that when reading the sources (that's why i deleted my post, must have crossed your reply). Thanks anyway!

siella
27th January 2014, 22:56
All extensions update as last versions of encoders. i added dts encoder and fgh aac encoder estensions. Also I added logo.
All extensions is start with @ now
http://109.imagebam.com/download/Tuz449s2JwDKC6IoF8eJpQ/30429/304289834/8.png

The files in this folder can be included in BeHappy folder or in a subfolder called 'encoder'.
If the subfolder 'encoder' exists, all the encoders must be inside it.

Some files are interfaces created by BeHappy team and are included here, but the rest must be obtained from the authors.
Some special versions with STDIN input are included also, when the old link don't work.
There are also Bepipe.7z with the command line Bepipe.exe and some sample.
Here are the last know url to download the encoders and the last version tested:

WavSplit.exe (Included. Author Tebasuna, to split in mono/stereo wav's instead multichannel output)

-- lossless encoders
flac.exe (free lossless FLAC encoder http://www.rarewares.org/lossless.php, v1.3)
ttaenc.exe (free lossless TTA True Audio encoder, special v3.4.1 with STDIN input, included)
wavpack.exe (free lossless WV WavPack encoder http://www.rarewares.org/lossless.php, http://www.wavpack.com/ v4.70)

-- lossy multichannel encoders
neroAacEnc.exe (free AAC-MP4 encoder from Nero, http://www.nero.com/eng/technologies-aac-codec.html v1.5.4.0)
aften.exe (free AC3 encoder by Justin Ruggles, in http://code.google.com/p/wavtoac3encoder/downloads/list v)
oggenc2.exe (free OGG encoder, http://www.rarewares.org/ogg-oggenc.php v2.85)

enc_aacPlus.exe (Included. Author Dimzon and BeHappy team, interface for enc_aacplus.dll http://www.un4seen.com/filez/4/enc_aacPlus.zip)
enc_aacplus.dll (free AAC CT encoder , from full Winamp 5.66)
nscrt.dll (needed for enc_aacplus.dll, from full Winamp 5.5)
libmp4v2.dll (needed for enc_aacplus.dll mp4 output, from full Winamp 5.66)

ffmpeg.exe (many options, maybe: http://ffmpeg-builds.sourceforge.net/)
enc_AudX_CLI.exe (Included. Author Dimzon, interface for audxlib.dll)
audxlib.dll (free MP3 encoder with surround features, http://www.aud-x.com/)
mp3sEncoder.exe (free MP3 Fraunhofer encoder, http://www.all4mp3.com/tools/sw_fhg_cl.html)

qtaacenc.exe (Apple quicktime aac encoder, it needs QuickTime 7.6.2 or later and VC2008 runtime http://tmkk.undo.jp/qtaacenc/
fhgaacenc.exe (interface for enc_fhgaac.dll, http://tmkk.undo.jp/tools/fhgaacenc-20120624.zip)
enc_fhgaac.dll (Fraunhofer FHG AAC Encoder, new version of AAC CT encoder, needed for fhgaacenc.exe from winamp 5.66)
nsutil.dll (needed for enc_fhgaac.dll, from full Winamp 5.66)

dcaenc.exe (dcaenc free DTS encoder,http://aepatrakov.narod.ru/index/0-2, v2)

-- lossy only stereo encoders
lame.exe (free MP3 encoder http://www.rarewares.org/mp3-lame-bundle.php, v3.99.5)
twolame.exe (free MP2 encoder, http://www.rarewares.org/mp3-others.php#twolame, included v0.3.13)
mpcenc.exe (free MPC MusePack encoder, http://www.musepack.net, v1.30)

Notes:
------
The GUI's to capture the encoder parameters are implemented in the main BeHappy.exe or in *.extensions files in the 'extensions' subfolder.
The *.extensions files can be edited with Notepad or similar to change a not supported option.
To change parameters to GUI encoder included in BeHappy.exe you need change the sources *.cs and compile.

The files in 'extensions' subfolder can also be placed at BeHappy folder.
The *.extension files can implement also DSP functions (ConvertSample, DownMix, DuplicateChannels, SSRC and UpMix), and AviSynth decoders (BassAudio.extension).

The mppenc v1.16 (SV7) was deprecated and the new MusePack encoder SV8 is named mpcenc.exe (actually v1.30) if you want use it you need edit MusePack.extension file.

For nero encoder information look at http://wiki.hydrogenaudio.org/index.php?title=NeroAAC

http://110.imagebam.com/download/K6S39gvuFBlyKVnunpwQuQ/30429/304289813/1.png
http://111.imagebam.com/download/tsdGHAejP-ErjwMgR42Xsg/30429/304289818/2.png
http://112.imagebam.com/download/FvWeUVSirPpaJK14z8pHgw/30429/304289822/3.png
http://109.imagebam.com/download/WRxX96eMjGxVjlLEljlYEg/30429/304289823/4.png
http://111.imagebam.com/download/o0jMp24PnVttLoHbcobT8g/30429/304289826/5.png
http://109.imagebam.com/download/F2ZSr1nO7sULlAUNWEAfAQ/30429/304289831/6.png

tebasuna51
28th January 2014, 00:55
... i added dts encoder and fgh aac encoder estensions. Also I added logo.

Thanks.

(I never know how to add a logo)

Tom Keller
28th January 2014, 16:32
I've got some additional Extensions:
one for the usage of qaac (http://sites.google.com/site/qaacpage/) (if someone prefer it over qtaacenc)
and another one for opusenc (http://www.opus-codec.org/downloads/)

(I never know how to add a logo)
The logos are *.png files as Base64 coded text. So you simply have to create your logo with the graphics software of your choice, then use one of the many Base64 online converters (http://base64converter.com/) to upload and convert the image... and add it to your *.extension file afterwards.

tebasuna51
28th January 2014, 17:03
Thanks.

New options:

LigH
30th January 2014, 09:53
I wonder if extensions are configurable in another way. This huge bunch of radio buttons makes me uncomfortable. Especially for QAAC, where I would prefer more options between quality 73 and 100 (I often prefer 82, but would never consider using the lowest possible). Using radio buttons to choose between CBR, CVBR and (t)VBR, and then having combo boxes to select the bitrate or quality level, may be more convenient, but would have to be supported by the extension designer features.

Tom Keller
30th January 2014, 16:25
Yes... i know - or some kind of slider for choosing the bitrate would be much more comfortable too. But as far as i understand, that's (sadly) not possible with the XML based extension scripts.

siella
2nd February 2014, 17:59
that's (sadly) not possible with the XML based extension scripts.
That's right. Behappy written C# language also is open source and maybe some person who know C# programmer add radio button.

Reino
2nd February 2014, 21:26
Also I added logo.How do you translate a picture to characters of code you can use in a text file?

Strange, I completely overlooked that paragraph. Thanks, LigH