Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
|
|
Thread Tools | Search this Thread | Display Modes |
10th February 2012, 21:07 | #1001 | Link | ||
Registered User
Join Date: Nov 2005
Posts: 693
|
Quote:
Quote:
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. Insert LoadDll("path\tak_deco_lib.dll") before Loadplugin("path\BassAudio.dll")!
__________________
My hobby website |
||
11th February 2012, 12:04 | #1002 | Link | |
Moderator
Join Date: Feb 2005
Location: Spain
Posts: 6,915
|
Quote:
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.
__________________
BeHappy, AviSynth audio transcoder. |
|
15th February 2012, 14:00 | #1003 | Link |
Registered User
Join Date: Nov 2005
Posts: 693
|
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, compared to the official one, which has been discussed here amongst other threads. Now if I understand correctly how to derive a DPLII matrix's coefficients, 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: Code:
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) } Code:
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.
__________________
My hobby website Last edited by Reino; 15th February 2012 at 14:51. Reason: syntax |
16th February 2012, 01:54 | #1004 | Link | |||
Moderator
Join Date: Feb 2005
Location: Spain
Posts: 6,915
|
Quote:
Quote:
Quote:
__________________
BeHappy, AviSynth audio transcoder. |
|||
16th February 2012, 13:01 | #1005 | Link |
Registered User
Join Date: Nov 2005
Posts: 693
|
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:
Code:
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) #----------------------------------------- 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: Code:
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) (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
__________________
My hobby website |
17th February 2012, 05:00 | #1006 | Link |
Moderator
Join Date: Feb 2005
Location: Spain
Posts: 6,915
|
- 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.
__________________
BeHappy, AviSynth audio transcoder. |
17th February 2012, 18:11 | #1007 | Link |
Registered User
Join Date: Nov 2005
Posts: 693
|
Code:
AudioDub(Blankclip(),NicDtsSource("test.dts")) b = (IsAudioFloat==true) ? String(" float") : String(" int") Subtitle(String(AudioBits) + "bit" + b) - 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: Code:
#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 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)?!
__________________
My hobby website |
17th February 2012, 20:15 | #1008 | Link | |
Moderator
Join Date: Feb 2005
Location: Spain
Posts: 6,915
|
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. Quote:
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
__________________
BeHappy, AviSynth audio transcoder. Last edited by tebasuna51; 18th February 2012 at 10:10. |
|
17th February 2012, 21:49 | #1009 | Link |
Registered User
Join Date: Nov 2005
Posts: 693
|
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! Thanks for all the info, tebasuna51!
__________________
My hobby website |
17th February 2012, 23:07 | #1010 | Link |
Registered User
Join Date: Nov 2004
Location: Poland
Posts: 2,843
|
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 Last edited by kolak; 18th February 2012 at 00:25. |
18th February 2012, 04:31 | #1011 | Link |
Moderator
Join Date: Feb 2005
Location: Spain
Posts: 6,915
|
Is possible but I don't like the idea.
EDIT: This is a modified version:
__________________
BeHappy, AviSynth audio transcoder. Last edited by tebasuna51; 18th February 2012 at 10:40. Reason: Add modified version |
9th August 2012, 21:39 | #1017 | Link |
Registered User
Join Date: Nov 2005
Posts: 693
|
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.
__________________
My hobby website |
10th August 2012, 14:02 | #1018 | Link |
Moderator
Join Date: Feb 2005
Location: Spain
Posts: 6,915
|
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.
__________________
BeHappy, AviSynth audio transcoder. |
10th August 2012, 17:46 | #1019 | Link |
Registered User
Join Date: Nov 2005
Posts: 693
|
You can't update BassAudio to make it work with Bass 2.4.9.0?
__________________
My hobby website |
11th August 2012, 09:21 | #1020 | Link |
Moderator
Join Date: Feb 2005
Location: Spain
Posts: 6,915
|
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.
__________________
BeHappy, AviSynth audio transcoder. |
Tags |
behappy |
|
|