-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDolbyAtmosBinauralizer.cmd
More file actions
154 lines (145 loc) · 6.12 KB
/
Copy pathDolbyAtmosBinauralizer.cmd
File metadata and controls
154 lines (145 loc) · 6.12 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
@Echo OFF
SETlocal EnableExtensions
SETlocal EnableDelayedExpansion
Set ALSOFT_LOGFILE=OpenAL.log
Set ALSOFT_LOGLEVEL=3
pushd "%~dp0"
:Begin
cls
Call :Print Dolby Atmos Binauralizer
Call :Print Script to spatialize Dolby Atmos tracks, using OpenAL Soft HRTF
Call :Print Version 1.2.0
If not exist "CavernizeGUI.exe" (
Call :Print [91mCavernizeGUI.exe does not exist.[0m
Call :Print [96mPress any key to check again after you've manually copied the files, and if not found, open the browser to download it and then extract it along with the other files into this folder...[0m
Pause >Nul
If not exist "CavernizeGUI.exe" (Start https://cavern.sbence.hu/cavern/downloading.php?get=cavernize_gui)
)
If not exist "truehdd.exe" (
If exist "%AppData%\Cavernize\truehdd\truehdd.exe" (
Copy "%AppData%\Cavernize\truehdd\truehdd.exe" "%~dp0truehdd.exe" >> DolbyAtmosBinauralizer.log 2>&1
) else (
Set FileNotFound=True
Call :Print [91mtruehdd.exe does not exist.[0m
Call :Print [96mPress any key to check again after you've manually copied the files, and if not found, open the browser to download it ^(x86_64-pc-windows-msvc^) and then extract it into this folder...[0m
Pause >Nul
If not exist "truehdd.exe" (Start https://github.com/truehdd/truehdd/releases/latest)
)
)
If not exist "allafplay.exe" (
Set FileNotFound=True
Call :Print [91mallafplay.exe does not exist.[0m
Call :Print [96mPress any key to check again after you've manually copied the files, and if not found, open the browser to download it and then extract it into this folder...[0m
Pause >Nul
If not exist "allafplay.exe" (Start https://github.com/kcat/openal-soft/releases/download/utils/utils.zip)
)
If not exist "ffmpeg.exe" (
Set FileNotFound=True
Call :Print [91mffmpeg.exe does not exist.[0m
Call :Print [96mPress any key to check again after you've manually copied the files, and if not found, open the browser to download it and then extract it into this folder...[0m
Pause >Nul
If not exist "ffmpeg.exe" (Start https://github.com/AnimMouse/ffmpeg-autobuild/releases/latest)
)
If not exist "OpenAL32.dll" (
Set FileNotFound=True
Call :Print [93mOpenAL32.dll does not exist.[0m
Call :Print [96mPress any key to check again after you've manually copied the files, and if not found, open the browser to download it ^(Win64^) and then extract it into this folder...[0m
Pause >Nul
If not exist "OpenAL32.dll" (Start https://github.com/kcat/openal-soft/releases/download/latest/OpenALSoft+HRTF.zip)
)
If not exist "alsoft.ini" (
Set FileNotFound=True
Call :Print [93malsoft.ini does not exist.[0m
Call :Print [96mPress any key to check again after you've manually copied the files, and if not found, open the browser to download it and then extract it into this folder...[0m
Pause >Nul
If not exist "alsoft.ini" (Start https://github.com/kcat/openal-soft/releases/download/latest/OpenALSoft+HRTF.zip)
)
If "!FileNotFound!"=="True" (
Set FileNotFound=
GoTo :Begin
)
If "%~1"=="" (
set /p Input=[96mDrag one or more files into this script file directly or into this window, then press Enter:[0m
For %%I in (!Input!) do (
IF EXIST "%%~I" (
If /I "%%~xI"==".laf" (
Call :Play "%%~I"
) else (
Call :Decode "%%~I"
)
)
)
) else (
for %%I in (%*) do (
IF EXIST "%%~I" (
If /I "%%~xI"==".laf" (
Call :Play "%%~I"
) else (
Call :Decode "%%~I"
)
)
)
)
Call :Print All tasks have been completed. Press any key to exit.
Pause >Nul
Exit
:Decode
Echo.
Call :Print [7m"%~1"[0m
MkDir "%AppData%\Cavernize\truehdd\" >> DolbyAtmosBinauralizer.log 2>&1
If not exist "%AppData%/Cavernize/truehdd.version" (
Call :Print "" >"%AppData%/Cavernize/truehdd.version"
)
If not exist "%AppData%\Cavernize\truehdd\truehdd.exe" (
If exist "truehdd.exe" (
Copy "truehdd.exe" "%AppData%\Cavernize\truehdd\truehdd.exe" >> DolbyAtmosBinauralizer.log 2>&1
)
)
For %%L in ("%~1") do (
If not defined ConversionMethodPrompted (
Set ConversionMethodPrompted=True
Call :Print [96mPress Enter to use piping ^(faster and less disk space usage^) or type anything then Enter for separate command calls ^(in case piping fails or hangs^).[0m
CALL :PromptInput ConversionMethod
)
IF not defined ConversionMethod (
Call :PrintLogRun CavernizeGUI.exe -input "%%~L" -format LimitlessAudio -output "%%~dpL%%~nL.laf"
) else (
Call :PrintLogRun ffmpeg.exe -y -i "%%~L" -c copy -f truehd "%%~dpL%%~nL.input"
Call :PrintLogRun truehdd.exe decode --progress "%%~dpL%%~nL.input" --output-path "%%~dpL%%~nL"
If exist "%%~dpL%%~nL.input" (Del "%%~dpL%%~nL.input" >> DolbyAtmosBinauralizer.log 2>&1)
Call :PrintLogRun CavernizeGUI.exe -input "%%~dpL%%~nL.atmos" -format LimitlessAudio -output "%%~dpL%%~nL.laf"
If exist "%%~dpL%%~nL.atmos" (Del "%%~dpL%%~nL.atmos" >> DolbyAtmosBinauralizer.log 2>&1)
If exist "%%~dpL%%~nL.atmos.audio" (Del "%%~dpL%%~nL.atmos.audio" >> DolbyAtmosBinauralizer.log 2>&1)
If exist "%%~dpL%%~nL.atmos.metadata" (Del "%%~dpL%%~nL.atmos.metadata" >> DolbyAtmosBinauralizer.log 2>&1)
)
Call :PrintLogRun allafplay.exe -render "hrtf,f32" "%%~dpL%%~nL.laf"
If exist "%%~dpL%%~nL.laf" (Del "%%~dpL%%~nL.laf" >> DolbyAtmosBinauralizer.log 2>&1)
If exist "%%~nL.caf" (Move "%%~nL.caf" "%%~dpL%%~nL.caf" >> DolbyAtmosBinauralizer.log 2>&1)
Call :PrintLogRun ffmpeg.exe -y -i "%%~dpL%%~nL.caf" -c:a flac -compression_level 12 -strict -2 "%%~dpL%%~nL.flac"
If exist "%%~dpL%%~nL.caf" (Del "%%~dpL%%~nL.caf" >> DolbyAtmosBinauralizer.log 2>&1)
Call :Print [0m
If exist "%%~dpL%%~nL.flac" (
Call :Print [92m"%%~dpL%%~nL.flac" has been generated.[0m
Call :Print [96mYou can now load it as an external track in supported media players.[0m
) else (
Call :Print [91mFailed to generate "%%~dpL%%~nL.flac".[0m
)
)
Exit /B
:Play
For %%L in ("%~1") do (
If exist "%%~dpL%%~nL.laf" (Call :PrintLogRun allafplay.exe "%%~dpL%%~nL.laf")
)
Exit /B
:Print
Echo %*
Exit /B
:PrintLogRun
Echo [94m%*[0m
Echo %* >> DolbyAtmosBinauralizer.log 2>&1
%*
Exit /B
:PromptInput
SET %1=
SET /P %1=%2
EXIT /B 0