Add files via upload

This commit is contained in:
Anjok07
2022-06-06 15:44:20 -05:00
committed by GitHub
parent aa2dd10834
commit 32a3df2044
3 changed files with 291 additions and 89 deletions

24
UVR.py
View File

@@ -114,6 +114,7 @@ DEFAULT_DATA = {
'chunks': 'Auto', 'chunks': 'Auto',
'n_fft_scale': 6144, 'n_fft_scale': 6144,
'dim_f': 2048, 'dim_f': 2048,
'noise_pro_select': 'Auto Select',
'overlap': 0.5, 'overlap': 0.5,
'shifts': 0, 'shifts': 0,
'margin': 44100, 'margin': 44100,
@@ -408,6 +409,7 @@ class MainWindow(TkinterDnD.Tk):
self.agg_var = tk.StringVar(value=data['agg']) self.agg_var = tk.StringVar(value=data['agg'])
self.n_fft_scale_var = tk.StringVar(value=data['n_fft_scale']) self.n_fft_scale_var = tk.StringVar(value=data['n_fft_scale'])
self.dim_f_var = tk.StringVar(value=data['dim_f']) self.dim_f_var = tk.StringVar(value=data['dim_f'])
self.noise_pro_select_var = tk.StringVar(value=data['noise_pro_select'])
self.overlap_var = tk.StringVar(value=data['overlap']) self.overlap_var = tk.StringVar(value=data['overlap'])
self.shifts_var = tk.StringVar(value=data['shifts']) self.shifts_var = tk.StringVar(value=data['shifts'])
self.channel_var = tk.StringVar(value=data['channel']) self.channel_var = tk.StringVar(value=data['channel'])
@@ -1083,6 +1085,7 @@ class MainWindow(TkinterDnD.Tk):
'mixing': mixing, 'mixing': mixing,
'n_fft_scale': self.n_fft_scale_var.get(), 'n_fft_scale': self.n_fft_scale_var.get(),
'dim_f': self.dim_f_var.get(), 'dim_f': self.dim_f_var.get(),
'noise_pro_select': self.noise_pro_select_var.get(),
'overlap': self.overlap_var.get(), 'overlap': self.overlap_var.get(),
'shifts': self.shifts_var.get(), 'shifts': self.shifts_var.get(),
'margin': self.margin_var.get(), 'margin': self.margin_var.get(),
@@ -1166,8 +1169,20 @@ class MainWindow(TkinterDnD.Tk):
for char in e: for char in e:
file_name_1 = file_name_1.replace(char, "UVR-MDX-NET 1") file_name_1 = file_name_1.replace(char, "UVR-MDX-NET 1")
f = ["UVR_MDXNET_KARA"] f = ["UVR_MDXNET_9662"]
for char in f: for char in f:
file_name_1 = file_name_1.replace(char, "UVR-MDX-NET 3")
g = ["UVR_MDXNET_9682"]
for char in g:
file_name_1 = file_name_1.replace(char, "UVR-MDX-NET 2")
h = ["UVR_MDXNET_9703"]
for char in h:
file_name_1 = file_name_1.replace(char, "UVR-MDX-NET 1")
i = ["UVR_MDXNET_KARA"]
for char in i:
file_name_1 = file_name_1.replace(char, "UVR-MDX-NET Karaoke") file_name_1 = file_name_1.replace(char, "UVR-MDX-NET Karaoke")
self.options_mdxnetModel_Optionmenu['menu'].add_radiobutton(label=file_name_1, self.options_mdxnetModel_Optionmenu['menu'].add_radiobutton(label=file_name_1,
@@ -1838,6 +1853,12 @@ class MainWindow(TkinterDnD.Tk):
l0=ttk.Entry(frame0, textvariable=self.compensate_var, justify='center') l0=ttk.Entry(frame0, textvariable=self.compensate_var, justify='center')
l0.grid(row=7,column=0,padx=0,pady=0) l0.grid(row=7,column=0,padx=0,pady=0)
l0=tk.Label(frame0, text='Noise Profile', font=("Century Gothic", "9"), foreground='#13a4c9')
l0.grid(row=8,column=0,padx=0,pady=10)
l0=ttk.OptionMenu(frame0, self.noise_pro_select_var, None, 'Auto Select', 'MDX-NET_Noise_Profile_14_kHz', 'MDX-NET_Noise_Profile_17_kHz', 'MDX-NET_Noise_Profile_Full_Band')
l0.grid(row=9,column=0,padx=0,pady=0)
frame0=Frame(tab2, highlightbackground='red',highlightthicknes=0) frame0=Frame(tab2, highlightbackground='red',highlightthicknes=0)
frame0.grid(row=0,column=0,padx=0,pady=30) frame0.grid(row=0,column=0,padx=0,pady=30)
@@ -2873,6 +2894,7 @@ class MainWindow(TkinterDnD.Tk):
'chunks': chunks, 'chunks': chunks,
'n_fft_scale': self.n_fft_scale_var.get(), 'n_fft_scale': self.n_fft_scale_var.get(),
'dim_f': self.dim_f_var.get(), 'dim_f': self.dim_f_var.get(),
'noise_pro_select': self.noise_pro_select_var.get(),
'overlap': self.overlap_var.get(), 'overlap': self.overlap_var.get(),
'shifts': self.shifts_var.get(), 'shifts': self.shifts_var.get(),
'margin': self.margin_var.get(), 'margin': self.margin_var.get(),

View File

@@ -9,6 +9,7 @@ import os.path
from datetime import datetime from datetime import datetime
import pydub import pydub
import shutil import shutil
import hashlib
import gc import gc
#MDX-Net #MDX-Net
@@ -257,9 +258,10 @@ class Predictor():
widget_text.write('Done!\n') widget_text.write('Done!\n')
widget_text.write(base_text + 'Performing Noise Reduction... ') widget_text.write(base_text + 'Performing Noise Reduction... ')
reduction_sen = float(data['noisereduc_s'])/10 reduction_sen = float(data['noisereduc_s'])/10
print(noise_pro_set)
subprocess.call("lib_v5\\sox\\sox.exe" + ' "' + subprocess.call("lib_v5\\sox\\sox.exe" + ' "' +
f"{str(non_reduced_vocal_path)}" + '" "' + f"{str(vocal_path)}" + '" ' + f"{str(non_reduced_vocal_path)}" + '" "' + f"{str(vocal_path)}" + '" ' +
"noisered lib_v5\\sox\\mdxnetnoisereduc.prof " + f"{reduction_sen}", "noisered lib_v5\\sox\\" + noise_pro_set + ".prof " + f"{reduction_sen}",
shell=True, stdout=subprocess.PIPE, shell=True, stdout=subprocess.PIPE,
stdin=subprocess.PIPE, stderr=subprocess.PIPE) stdin=subprocess.PIPE, stderr=subprocess.PIPE)
update_progress(**progress_kwargs, update_progress(**progress_kwargs,
@@ -688,6 +690,7 @@ data = {
'inst_only': False, 'inst_only': False,
'n_fft_scale': 6144, 'n_fft_scale': 6144,
'dim_f': 2048, 'dim_f': 2048,
'noise_pro_select': 'Auto Select',
'overlap': 0.5, 'overlap': 0.5,
'shifts': 0, 'shifts': 0,
'margin': 44100, 'margin': 44100,
@@ -747,6 +750,9 @@ def main(window: tk.Wm, text_widget: tk.Text, button_widget: tk.Button, progress
global model_set global model_set
global model_set_name global model_set_name
global stemset_n global stemset_n
global noise_pro_set
global mdx_model_hash
global channel_set global channel_set
global margin_set global margin_set
@@ -773,6 +779,7 @@ def main(window: tk.Wm, text_widget: tk.Text, button_widget: tk.Button, progress
file_err = "FileNotFoundError" file_err = "FileNotFoundError"
ffmp_err = """audioread\__init__.py", line 116, in audio_open""" ffmp_err = """audioread\__init__.py", line 116, in audio_open"""
sf_write_err = "sf.write" sf_write_err = "sf.write"
model_adv_set_err = "Got invalid dimensions for input"
try: try:
with open('errorlog.txt', 'w') as f: with open('errorlog.txt', 'w') as f:
@@ -816,70 +823,168 @@ def main(window: tk.Wm, text_widget: tk.Text, button_widget: tk.Button, progress
source_val_set = 0 source_val_set = 0
stem_name = '(Bass)' stem_name = '(Bass)'
if data['mdxnetModel'] == 'UVR-MDX-NET 1':
model_set = 'UVR_MDXNET_1_9703' try:
model_set_name = 'UVR_MDXNET_1_9703' if data['mdxnetModel'] == 'UVR-MDX-NET 1':
modeltype = 'v' model_set = 'UVR_MDXNET_1_9703'
stemset_n = '(Vocals)' model_set_name = 'UVR_MDXNET_1_9703'
source_val = 3 modeltype = 'v'
n_fft_scale_set=6144 noise_pro = 'MDX-NET_Noise_Profile_14_kHz'
dim_f_set=2048 stemset_n = '(Vocals)'
elif data['mdxnetModel'] == 'UVR-MDX-NET 2': source_val = 3
model_set = 'UVR_MDXNET_2_9682' n_fft_scale_set=6144
model_set_name = 'UVR_MDXNET_2_9682' dim_f_set=2048
modeltype = 'v' elif data['mdxnetModel'] == 'UVR-MDX-NET 2':
stemset_n = '(Vocals)' model_set = 'UVR_MDXNET_2_9682'
source_val = 3 model_set_name = 'UVR_MDXNET_2_9682'
n_fft_scale_set=6144 modeltype = 'v'
dim_f_set=2048 noise_pro = 'MDX-NET_Noise_Profile_14_kHz'
elif data['mdxnetModel'] == 'UVR-MDX-NET 3': stemset_n = '(Vocals)'
model_set = 'UVR_MDXNET_3_9662' source_val = 3
model_set_name = 'UVR_MDXNET_3_9662' n_fft_scale_set=6144
modeltype = 'v' dim_f_set=2048
stemset_n = '(Vocals)' elif data['mdxnetModel'] == 'UVR-MDX-NET 3':
source_val = 3 model_set = 'UVR_MDXNET_3_9662'
n_fft_scale_set=6144 model_set_name = 'UVR_MDXNET_3_9662'
dim_f_set=2048 modeltype = 'v'
elif data['mdxnetModel'] == 'UVR-MDX-NET Karaoke': noise_pro = 'MDX-NET_Noise_Profile_14_kHz'
model_set = 'UVR_MDXNET_KARA' stemset_n = '(Vocals)'
model_set_name = 'UVR_MDXNET_Karaoke' source_val = 3
modeltype = 'v' n_fft_scale_set=6144
stemset_n = '(Vocals)' dim_f_set=2048
source_val = 3 elif data['mdxnetModel'] == 'UVR-MDX-NET Karaoke':
n_fft_scale_set=6144 model_set = 'UVR_MDXNET_KARA'
dim_f_set=2048 model_set_name = 'UVR_MDXNET_Karaoke'
elif data['mdxnetModel'] == 'other': modeltype = 'v'
model_set = 'other' noise_pro = 'MDX-NET_Noise_Profile_14_kHz'
model_set_name = 'other' stemset_n = '(Vocals)'
modeltype = 'o' source_val = 3
stemset_n = '(Other)' n_fft_scale_set=6144
source_val = 2 dim_f_set=2048
n_fft_scale_set=8192 elif data['mdxnetModel'] == 'other':
dim_f_set=2048 model_set = 'other'
elif data['mdxnetModel'] == 'drums': model_set_name = 'other'
model_set = 'drums' modeltype = 'o'
model_set_name = 'drums' noise_pro = 'MDX-NET_Noise_Profile_Full_Band'
modeltype = 'd' stemset_n = '(Other)'
stemset_n = '(Drums)' source_val = 2
source_val = 1 n_fft_scale_set=8192
n_fft_scale_set=4096 dim_f_set=2048
dim_f_set=2048 elif data['mdxnetModel'] == 'drums':
elif data['mdxnetModel'] == 'bass': model_set = 'drums'
model_set = 'bass' model_set_name = 'drums'
model_set_name = 'bass' modeltype = 'd'
modeltype = 'b' noise_pro = 'MDX-NET_Noise_Profile_Full_Band'
stemset_n = '(Bass)' stemset_n = '(Drums)'
source_val = 0 source_val = 1
n_fft_scale_set=16384 n_fft_scale_set=4096
dim_f_set=2048 dim_f_set=2048
elif data['mdxnetModel'] == 'bass':
model_set = 'bass'
model_set_name = 'bass'
modeltype = 'b'
noise_pro = 'MDX-NET_Noise_Profile_Full_Band'
stemset_n = '(Bass)'
source_val = 0
n_fft_scale_set=16384
dim_f_set=2048
else:
model_set = data['mdxnetModel']
model_set_name = data['mdxnetModel']
modeltype = stemset
noise_pro = 'MDX-NET_Noise_Profile_Full_Band'
stemset_n = stem_name
source_val = source_val_set
n_fft_scale_set=int(data['n_fft_scale'])
dim_f_set=int(data['dim_f'])
MDXModelName=('models/MDX_Net_Models/' + model_set + '.onnx')
mdx_model_hash = hashlib.md5(open(MDXModelName, 'rb').read()).hexdigest()
print(mdx_model_hash)
except:
if data['mdxnetModel'] == 'UVR-MDX-NET 1':
model_set = 'UVR_MDXNET_9703'
model_set_name = 'UVR_MDXNET_9703'
modeltype = 'v'
noise_pro = 'MDX-NET_Noise_Profile_14_kHz'
stemset_n = '(Vocals)'
source_val = 3
n_fft_scale_set=6144
dim_f_set=2048
elif data['mdxnetModel'] == 'UVR-MDX-NET 2':
model_set = 'UVR_MDXNET_9682'
model_set_name = 'UVR_MDXNET_9682'
modeltype = 'v'
noise_pro = 'MDX-NET_Noise_Profile_14_kHz'
stemset_n = '(Vocals)'
source_val = 3
n_fft_scale_set=6144
dim_f_set=2048
elif data['mdxnetModel'] == 'UVR-MDX-NET 3':
model_set = 'UVR_MDXNET_9662'
model_set_name = 'UVR_MDXNET_9662'
modeltype = 'v'
noise_pro = 'MDX-NET_Noise_Profile_14_kHz'
stemset_n = '(Vocals)'
source_val = 3
n_fft_scale_set=6144
dim_f_set=2048
elif data['mdxnetModel'] == 'UVR-MDX-NET Karaoke':
model_set = 'UVR_MDXNET_KARA'
model_set_name = 'UVR_MDXNET_Karaoke'
modeltype = 'v'
noise_pro = 'MDX-NET_Noise_Profile_14_kHz'
stemset_n = '(Vocals)'
source_val = 3
n_fft_scale_set=6144
dim_f_set=2048
elif data['mdxnetModel'] == 'other':
model_set = 'other'
model_set_name = 'other'
modeltype = 'o'
noise_pro = 'MDX-NET_Noise_Profile_Full_Band'
stemset_n = '(Other)'
source_val = 2
n_fft_scale_set=8192
dim_f_set=2048
elif data['mdxnetModel'] == 'drums':
model_set = 'drums'
model_set_name = 'drums'
modeltype = 'd'
noise_pro = 'MDX-NET_Noise_Profile_Full_Band'
stemset_n = '(Drums)'
source_val = 1
n_fft_scale_set=4096
dim_f_set=2048
elif data['mdxnetModel'] == 'bass':
model_set = 'bass'
model_set_name = 'bass'
modeltype = 'b'
noise_pro = 'MDX-NET_Noise_Profile_Full_Band'
stemset_n = '(Bass)'
source_val = 0
n_fft_scale_set=16384
dim_f_set=2048
else:
model_set = data['mdxnetModel']
model_set_name = data['mdxnetModel']
modeltype = stemset
noise_pro = 'MDX-NET_Noise_Profile_Full_Band'
stemset_n = stem_name
source_val = source_val_set
n_fft_scale_set=int(data['n_fft_scale'])
dim_f_set=int(data['dim_f'])
MDXModelName=('models/MDX_Net_Models/' + model_set_name + '.onnx')
mdx_model_hash = hashlib.md5(open(MDXModelName, 'rb').read()).hexdigest()
print(mdx_model_hash)
if data['noise_pro_select'] == 'Auto Select':
noise_pro_set = noise_pro
else: else:
model_set = data['mdxnetModel'] noise_pro_set = data['noise_pro_select']
model_set_name = data['mdxnetModel']
modeltype = stemset
stemset_n = stem_name
source_val = source_val_set
n_fft_scale_set=int(data['n_fft_scale'])
dim_f_set=int(data['dim_f'])
print(n_fft_scale_set) print(n_fft_scale_set)
print(dim_f_set) print(dim_f_set)
@@ -1135,7 +1240,7 @@ def main(window: tk.Wm, text_widget: tk.Text, button_widget: tk.Button, progress
with open('errorlog.txt', 'w') as f: with open('errorlog.txt', 'w') as f:
f.write(f'Last Error Received:\n\n' + f.write(f'Last Error Received:\n\n' +
f'Error Received while processing "{os.path.basename(music_file)}":\n' + f'Error Received while processing "{os.path.basename(music_file)}":\n' +
f'Process Method: Ensemble Mode\n\n' + f'Process Method: MDX-Net\n\n' +
f'The application was unable to allocate enough GPU memory to use this model.\n' + f'The application was unable to allocate enough GPU memory to use this model.\n' +
f'Please do the following:\n\n1. Close any GPU intensive applications.\n2. Lower the set chunk size.\n3. Then try again.\n\n' + f'Please do the following:\n\n1. Close any GPU intensive applications.\n2. Lower the set chunk size.\n3. Then try again.\n\n' +
f'If the error persists, your GPU might not be supported.\n\n' + f'If the error persists, your GPU might not be supported.\n\n' +
@@ -1159,7 +1264,7 @@ def main(window: tk.Wm, text_widget: tk.Text, button_widget: tk.Button, progress
with open('errorlog.txt', 'w') as f: with open('errorlog.txt', 'w') as f:
f.write(f'Last Error Received:\n\n' + f.write(f'Last Error Received:\n\n' +
f'Error Received while processing "{os.path.basename(music_file)}":\n' + f'Error Received while processing "{os.path.basename(music_file)}":\n' +
f'Process Method: Ensemble Mode\n\n' + f'Process Method: MDX-Net\n\n' +
f'The application was unable to allocate enough GPU memory to use this model.\n' + f'The application was unable to allocate enough GPU memory to use this model.\n' +
f'Please do the following:\n\n1. Close any GPU intensive applications.\n2. Lower the set chunk size.\n3. Then try again.\n\n' + f'Please do the following:\n\n1. Close any GPU intensive applications.\n2. Lower the set chunk size.\n3. Then try again.\n\n' +
f'If the error persists, your GPU might not be supported.\n\n' + f'If the error persists, your GPU might not be supported.\n\n' +
@@ -1184,7 +1289,7 @@ def main(window: tk.Wm, text_widget: tk.Text, button_widget: tk.Button, progress
with open('errorlog.txt', 'w') as f: with open('errorlog.txt', 'w') as f:
f.write(f'Last Error Received:\n\n' + f.write(f'Last Error Received:\n\n' +
f'Error Received while processing "{os.path.basename(music_file)}":\n' + f'Error Received while processing "{os.path.basename(music_file)}":\n' +
f'Process Method: Ensemble Mode\n\n' + f'Process Method: MDX-Net\n\n' +
f'Could not write audio file.\n' + f'Could not write audio file.\n' +
f'This could be due to low storage on target device or a system permissions issue.\n' + f'This could be due to low storage on target device or a system permissions issue.\n' +
f'If the error persists, please contact the developers.\n\n' + f'If the error persists, please contact the developers.\n\n' +
@@ -1209,7 +1314,7 @@ def main(window: tk.Wm, text_widget: tk.Text, button_widget: tk.Button, progress
with open('errorlog.txt', 'w') as f: with open('errorlog.txt', 'w') as f:
f.write(f'Last Error Received:\n\n' + f.write(f'Last Error Received:\n\n' +
f'Error Received while processing "{os.path.basename(music_file)}":\n' + f'Error Received while processing "{os.path.basename(music_file)}":\n' +
f'Process Method: Ensemble Mode\n\n' + f'Process Method: MDX-Net\n\n' +
f'The application was unable to allocate enough system memory to use this model.\n' + f'The application was unable to allocate enough system memory to use this model.\n' +
f'Please do the following:\n\n1. Restart this application.\n2. Ensure any CPU intensive applications are closed.\n3. Then try again.\n\n' + f'Please do the following:\n\n1. Restart this application.\n2. Ensure any CPU intensive applications are closed.\n3. Then try again.\n\n' +
f'Please Note: Intel Pentium and Intel Celeron processors do not work well with this application.\n\n' + f'Please Note: Intel Pentium and Intel Celeron processors do not work well with this application.\n\n' +
@@ -1222,6 +1327,28 @@ def main(window: tk.Wm, text_widget: tk.Text, button_widget: tk.Button, progress
button_widget.configure(state=tk.NORMAL) # Enable Button button_widget.configure(state=tk.NORMAL) # Enable Button
return return
if model_adv_set_err in message:
text_widget.write("\n" + base_text + f'Separation failed for the following audio file:\n')
text_widget.write(base_text + f'"{os.path.basename(music_file)}"\n')
text_widget.write(f'\nError Received:\n\n')
text_widget.write(f'The current ONNX model settings are not compatible with the selected \nmodel.\n\n')
text_widget.write(f'Please re-configure the advanced ONNX model settings accordingly and try \nagain.\n\n')
text_widget.write(f'Time Elapsed: {time.strftime("%H:%M:%S", time.gmtime(int(time.perf_counter() - stime)))}')
try:
with open('errorlog.txt', 'w') as f:
f.write(f'Last Error Received:\n\n' +
f'Error Received while processing "{os.path.basename(music_file)}":\n' +
f'Process Method: MDX-Net\n\n' +
f'The current ONNX model settings are not compatible with the selected model.\n\n' +
f'Please re-configure the advanced ONNX model settings accordingly and try again.\n\n' +
message + f'\nError Time Stamp [{datetime.now().strftime("%Y-%m-%d %H:%M:%S")}]\n')
except:
pass
torch.cuda.empty_cache()
progress_var.set(0)
button_widget.configure(state=tk.NORMAL) # Enable Button
return
print(traceback_text) print(traceback_text)
print(type(e).__name__, e) print(type(e).__name__, e)

View File

@@ -167,9 +167,10 @@ class Predictor():
widget_text.write('Done!\n') widget_text.write('Done!\n')
widget_text.write(base_text + 'Performing Noise Reduction... ') widget_text.write(base_text + 'Performing Noise Reduction... ')
reduction_sen = float(int(data['noisereduc_s'])/10) reduction_sen = float(int(data['noisereduc_s'])/10)
print(noise_pro_set)
subprocess.call("lib_v5\\sox\\sox.exe" + ' "' + subprocess.call("lib_v5\\sox\\sox.exe" + ' "' +
f"{str(non_reduced_vocal_path)}" + '" "' + f"{str(vocal_path)}" + '" ' + f"{str(non_reduced_vocal_path)}" + '" "' + f"{str(vocal_path)}" + '" ' +
"noisered lib_v5\\sox\\mdxnetnoisereduc.prof " + f"{reduction_sen}", "noisered lib_v5\\sox\\" + noise_pro_set + ".prof " + f"{reduction_sen}",
shell=True, stdout=subprocess.PIPE, shell=True, stdout=subprocess.PIPE,
stdin=subprocess.PIPE, stderr=subprocess.PIPE) stdin=subprocess.PIPE, stderr=subprocess.PIPE)
widget_text.write('Done!\n') widget_text.write('Done!\n')
@@ -188,7 +189,7 @@ class Predictor():
reduction_sen = float(data['noisereduc_s'])/10 reduction_sen = float(data['noisereduc_s'])/10
subprocess.call("lib_v5\\sox\\sox.exe" + ' "' + subprocess.call("lib_v5\\sox\\sox.exe" + ' "' +
f"{str(non_reduced_vocal_path)}" + '" "' + f"{str(vocal_path)}" + '" ' + f"{str(non_reduced_vocal_path)}" + '" "' + f"{str(vocal_path)}" + '" ' +
"noisered lib_v5\\sox\\mdxnetnoisereduc.prof " + f"{reduction_sen}", "noisered lib_v5\\sox\\" + noise_pro_set + ".prof " + f"{reduction_sen}",
shell=True, stdout=subprocess.PIPE, shell=True, stdout=subprocess.PIPE,
stdin=subprocess.PIPE, stderr=subprocess.PIPE) stdin=subprocess.PIPE, stderr=subprocess.PIPE)
update_progress(**progress_kwargs, update_progress(**progress_kwargs,
@@ -570,7 +571,7 @@ data = {
'algo': 'Instrumentals (Min Spec)', 'algo': 'Instrumentals (Min Spec)',
#Advanced Options #Advanced Options
'appendensem': False, 'appendensem': False,
'noise_pro_select': 'Auto Select',
'overlap': 0.5, 'overlap': 0.5,
'shifts': 0, 'shifts': 0,
'margin': 44100, 'margin': 44100,
@@ -624,12 +625,16 @@ def main(window: tk.Wm, text_widget: tk.Text, button_widget: tk.Button, progress
global model_set global model_set
global model_set_name global model_set_name
global ModelName_2 global ModelName_2
global mdx_model_hash
global channel_set global channel_set
global margin_set global margin_set
global overlap_set global overlap_set
global shift_set global shift_set
global noise_pro_set
global n_fft_scale_set global n_fft_scale_set
global dim_f_set global dim_f_set
@@ -1215,16 +1220,37 @@ def main(window: tk.Wm, text_widget: tk.Text, button_widget: tk.Button, progress
vr_ensem_mdx_c_name = data['vr_ensem_mdx_c'] vr_ensem_mdx_c_name = data['vr_ensem_mdx_c']
vr_ensem_mdx_c = f'models/Main_Models/{vr_ensem_mdx_c_name}.pth' vr_ensem_mdx_c = f'models/Main_Models/{vr_ensem_mdx_c_name}.pth'
#MDX-Net Model
if data['mdx_ensem'] == 'UVR-MDX-NET 1':
mdx_ensem = 'UVR_MDXNET_1_9703'
if data['mdx_ensem'] == 'UVR-MDX-NET 2': #MDX-Net Model
mdx_ensem = 'UVR_MDXNET_2_9682' try:
if data['mdx_ensem'] == 'UVR-MDX-NET 3': if data['mdx_ensem'] == 'UVR-MDX-NET 1':
mdx_ensem = 'UVR_MDXNET_3_9662' mdx_ensem = 'UVR_MDXNET_1_9703'
if data['mdx_ensem'] == 'UVR-MDX-NET Karaoke': if data['mdx_ensem'] == 'UVR-MDX-NET 2':
mdx_ensem = 'UVR_MDXNET_KARA' mdx_ensem = 'UVR_MDXNET_2_9682'
if data['mdx_ensem'] == 'UVR-MDX-NET 3':
mdx_ensem = 'UVR_MDXNET_3_9662'
if data['mdx_ensem'] == 'UVR-MDX-NET Karaoke':
mdx_ensem = 'UVR_MDXNET_KARA'
MDXModelName=('models/MDX_Net_Models/' + mdx_ensem + '.onnx')
mdx_model_hash = hashlib.md5(open(MDXModelName, 'rb').read()).hexdigest()
print(mdx_ensem)
except:
if data['mdx_ensem'] == 'UVR-MDX-NET 1':
mdx_ensem = 'UVR_MDXNET_9703'
if data['mdx_ensem'] == 'UVR-MDX-NET 2':
mdx_ensem = 'UVR_MDXNET_9682'
if data['mdx_ensem'] == 'UVR-MDX-NET 3':
mdx_ensem = 'UVR_MDXNET_9662'
if data['mdx_ensem'] == 'UVR-MDX-NET Karaoke':
mdx_ensem = 'UVR_MDXNET_KARA'
MDXModelName=('models/MDX_Net_Models/' + mdx_ensem + '.onnx')
mdx_model_hash = hashlib.md5(open(MDXModelName, 'rb').read()).hexdigest()
print(mdx_model_hash)
print(mdx_ensem)
#MDX-Net Model 2 #MDX-Net Model 2
@@ -1236,12 +1262,10 @@ def main(window: tk.Wm, text_widget: tk.Text, button_widget: tk.Button, progress
if data['mdx_ensem_b'] == 'UVR-MDX-NET 3': if data['mdx_ensem_b'] == 'UVR-MDX-NET 3':
mdx_ensem_b = 'UVR_MDXNET_3_9662' mdx_ensem_b = 'UVR_MDXNET_3_9662'
if data['mdx_ensem_b'] == 'UVR-MDX-NET Karaoke': if data['mdx_ensem_b'] == 'UVR-MDX-NET Karaoke':
mdx_ensem_b = 'UVR_MDXNET_Karaoke' mdx_ensem_b = 'UVR_MDXNET_KARA'
if data['mdx_ensem_b'] == 'No Model': if data['mdx_ensem_b'] == 'No Model':
mdx_ensem_b = 'pass' mdx_ensem_b = 'pass'
if data['vr_ensem'] == 'No Model' and data['vr_ensem_mdx_a'] == 'No Model' and data['vr_ensem_mdx_b'] == 'No Model' and data['vr_ensem_mdx_c'] == 'No Model': if data['vr_ensem'] == 'No Model' and data['vr_ensem_mdx_a'] == 'No Model' and data['vr_ensem_mdx_b'] == 'No Model' and data['vr_ensem_mdx_c'] == 'No Model':
mdx_vr = [ mdx_vr = [
{ {
@@ -1949,22 +1973,51 @@ def main(window: tk.Wm, text_widget: tk.Text, button_widget: tk.Button, progress
text_widget.write('Ensemble Mode - Running Model - ' + mdx_name + '\n\n') text_widget.write('Ensemble Mode - Running Model - ' + mdx_name + '\n\n')
if mdx_name == 'UVR_MDXNET_1_9703': if mdx_name == 'UVR_MDXNET_1_9703':
mdx_ensem_b = 'UVR_MDXNET_1_9703'
model_set = 'UVR_MDXNET_1_9703.onnx' model_set = 'UVR_MDXNET_1_9703.onnx'
model_set_name = 'UVR_MDXNET_1_9703' model_set_name = 'UVR_MDXNET_1_9703'
modeltype = 'v' modeltype = 'v'
noise_pro = 'MDX-NET_Noise_Profile_14_kHz'
if mdx_name == 'UVR_MDXNET_2_9682': if mdx_name == 'UVR_MDXNET_2_9682':
model_set = 'UVR_MDXNET_2_9682.onnx' model_set = 'UVR_MDXNET_2_9682.onnx'
model_set_name = 'UVR_MDXNET_2_9682' model_set_name = 'UVR_MDXNET_2_9682'
modeltype = 'v' modeltype = 'v'
noise_pro = 'MDX-NET_Noise_Profile_14_kHz'
if mdx_name == 'UVR_MDXNET_3_9662': if mdx_name == 'UVR_MDXNET_3_9662':
model_set = 'UVR_MDXNET_3_9662.onnx' model_set = 'UVR_MDXNET_3_9662.onnx'
model_set_name = 'UVR_MDXNET_3_9662' model_set_name = 'UVR_MDXNET_3_9662'
modeltype = 'v' modeltype = 'v'
if mdx_name == 'UVR_MDXNET_Karaoke': noise_pro = 'MDX-NET_Noise_Profile_14_kHz'
if mdx_name == 'UVR_MDXNET_KARA':
model_set = 'UVR_MDXNET_KARA.onnx' model_set = 'UVR_MDXNET_KARA.onnx'
model_set_name = 'UVR_MDXNET_Karaoke' model_set_name = 'UVR_MDXNET_KARA'
modeltype = 'v' modeltype = 'v'
noise_pro = 'MDX-NET_Noise_Profile_14_kHz'
if mdx_name == 'UVR_MDXNET_9703':
model_set = 'UVR_MDXNET_9703.onnx'
model_set_name = 'UVR_MDXNET_9703'
modeltype = 'v'
noise_pro = 'MDX-NET_Noise_Profile_14_kHz'
if mdx_name == 'UVR_MDXNET_9682':
model_set = 'UVR_MDXNET_9682.onnx'
model_set_name = 'UVR_MDXNET_9682'
modeltype = 'v'
noise_pro = 'MDX-NET_Noise_Profile_14_kHz'
if mdx_name == 'UVR_MDXNET_9662':
model_set = 'UVR_MDXNET_9662.onnx'
model_set_name = 'UVR_MDXNET_9662'
modeltype = 'v'
noise_pro = 'MDX-NET_Noise_Profile_14_kHz'
if mdx_name == 'UVR_MDXNET_KARA':
model_set = 'UVR_MDXNET_KARA.onnx'
model_set_name = 'UVR_MDXNET_KARA'
modeltype = 'v'
noise_pro = 'MDX-NET_Noise_Profile_14_kHz'
if data['noise_pro_select'] == 'Auto Select':
noise_pro_set = noise_pro
else:
noise_pro_set = data['noise_pro_select']
update_progress(**progress_kwargs, update_progress(**progress_kwargs,
step=0) step=0)