Add files via upload

This commit is contained in:
Anjok07 2022-07-03 20:18:27 -05:00 committed by GitHub
parent 04f29d3bb7
commit df51d61602
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 231 additions and 54 deletions

65
UVR.py
View File

@ -112,7 +112,7 @@ DEFAULT_DATA = {
'demucs_only': False, 'demucs_only': False,
'split_mode': True, 'split_mode': True,
#MDX-Net #MDX-Net
'demucsmodel': True, 'demucsmodel': False,
'demucsmodelVR': False, 'demucsmodelVR': False,
'non_red': False, 'non_red': False,
'noise_reduc': True, 'noise_reduc': True,
@ -124,6 +124,7 @@ DEFAULT_DATA = {
'audfile': True, 'audfile': True,
'autocompensate': True, 'autocompensate': True,
'chunks': 'Auto', 'chunks': 'Auto',
'chunks_d': 'Full',
'n_fft_scale': 6144, 'n_fft_scale': 6144,
'segment': 'None', 'segment': 'None',
'dim_f': 2048, 'dim_f': 2048,
@ -427,6 +428,7 @@ class MainWindow(TkinterDnD.Tk):
self.nophaseinst_var = tk.BooleanVar(value=data['nophaseinst']) self.nophaseinst_var = tk.BooleanVar(value=data['nophaseinst'])
self.noisereduc_var = tk.BooleanVar(value=data['noise_reduc']) self.noisereduc_var = tk.BooleanVar(value=data['noise_reduc'])
self.chunks_var = tk.StringVar(value=data['chunks']) self.chunks_var = tk.StringVar(value=data['chunks'])
self.chunks_d_var = tk.StringVar(value=data['chunks_d'])
self.noisereduc_s_var = tk.StringVar(value=data['noisereduc_s']) self.noisereduc_s_var = tk.StringVar(value=data['noisereduc_s'])
self.mixing_var = tk.StringVar(value=data['mixing']) #dropdown self.mixing_var = tk.StringVar(value=data['mixing']) #dropdown
# Models # Models
@ -724,6 +726,17 @@ class MainWindow(TkinterDnD.Tk):
'55', '60', '65', '70', '75', '80', '55', '60', '65', '70', '75', '80',
'85', '90', '95', 'Full') '85', '90', '95', 'Full')
# Demucs-Segment
self.options_segment_Label = tk.Label(master=self.options_Frame,
text='Segment',
background='#0e0e0f', font=self.font, foreground='#13a4c9')
self.options_segment_Optionmenu = ttk.OptionMenu(self.options_Frame,
self.segment_var,
None, 'None', '1', '5', '10', '15', '20',
'25', '30', '35', '40', '45', '50',
'55', '60', '65', '70', '75', '80',
'85', '90', '95', '100')
# Overlap # Overlap
self.options_overlap_b_Label = tk.Label(master=self.options_Frame, self.options_overlap_b_Label = tk.Label(master=self.options_Frame,
@ -920,6 +933,12 @@ class MainWindow(TkinterDnD.Tk):
self.options_chunks_Optionmenu.place(x=71, y=-2, width=-118, height=7, self.options_chunks_Optionmenu.place(x=71, y=-2, width=-118, height=7,
relx=2/3, rely=3/self.COL2_ROWS, relwidth=1/3, relheight=1/self.COL2_ROWS) relx=2/3, rely=3/self.COL2_ROWS, relwidth=1/3, relheight=1/self.COL2_ROWS)
# Demucs-Segment
self.options_segment_Label.place(x=12, y=0, width=0, height=-10,
relx=2/3, rely=2/self.COL2_ROWS, relwidth=1/3, relheight=1/self.COL2_ROWS)
self.options_segment_Optionmenu.place(x=71, y=-2, width=-118, height=7,
relx=2/3, rely=3/self.COL2_ROWS, relwidth=1/3, relheight=1/self.COL2_ROWS)
# Overlap # Overlap
self.options_overlap_b_Label.place(x=13, y=0, width=0, height=-10, self.options_overlap_b_Label.place(x=13, y=0, width=0, height=-10,
relx=2/3, rely=4/self.COL2_ROWS, relwidth=1/3, relheight=1/self.COL2_ROWS) relx=2/3, rely=4/self.COL2_ROWS, relwidth=1/3, relheight=1/self.COL2_ROWS)
@ -1242,6 +1261,7 @@ class MainWindow(TkinterDnD.Tk):
'audfile': self.audfile_var.get(), 'audfile': self.audfile_var.get(),
'autocompensate': self.autocompensate_var.get(), 'autocompensate': self.autocompensate_var.get(),
'chunks': chunks, 'chunks': chunks,
'chunks_d': self.chunks_d_var.get(),
'noisereduc_s': noisereduc_s, 'noisereduc_s': noisereduc_s,
'mixing': mixing, 'mixing': mixing,
'n_fft_scale': self.n_fft_scale_var.get(), 'n_fft_scale': self.n_fft_scale_var.get(),
@ -1512,6 +1532,8 @@ class MainWindow(TkinterDnD.Tk):
self.options_shifts_b_Optionmenu.place_forget() self.options_shifts_b_Optionmenu.place_forget()
self.options_split_Checkbutton.configure(state=tk.DISABLED) self.options_split_Checkbutton.configure(state=tk.DISABLED)
self.options_split_Checkbutton.place_forget() self.options_split_Checkbutton.place_forget()
self.options_segment_Label.place_forget()
self.options_segment_Optionmenu.place_forget()
elif self.aiModel_var.get() == 'VR Architecture': elif self.aiModel_var.get() == 'VR Architecture':
@ -1594,6 +1616,8 @@ class MainWindow(TkinterDnD.Tk):
self.options_shifts_b_Optionmenu.place_forget() self.options_shifts_b_Optionmenu.place_forget()
self.options_split_Checkbutton.configure(state=tk.DISABLED) self.options_split_Checkbutton.configure(state=tk.DISABLED)
self.options_split_Checkbutton.place_forget() self.options_split_Checkbutton.place_forget()
self.options_segment_Label.place_forget()
self.options_segment_Optionmenu.place_forget()
elif self.aiModel_var.get() == 'Demucs v3': elif self.aiModel_var.get() == 'Demucs v3':
#Keep for Ensemble & VR Architecture Mode #Keep for Ensemble & VR Architecture Mode
@ -1609,10 +1633,10 @@ class MainWindow(TkinterDnD.Tk):
self.options_demucs_stems_Optionmenu.place(x=55, y=-2, width=-85, height=7, self.options_demucs_stems_Optionmenu.place(x=55, y=-2, width=-85, height=7,
relx=1/3, rely=3/self.COL2_ROWS, relwidth=1/3, relheight=1/self.COL2_ROWS) relx=1/3, rely=3/self.COL2_ROWS, relwidth=1/3, relheight=1/self.COL2_ROWS)
# Chunks # Segment
self.options_chunks_Label.place(x=12, y=0, width=0, height=-10, self.options_segment_Label.place(x=12, y=0, width=0, height=-10,
relx=2/3, rely=2/self.COL2_ROWS, relwidth=1/3, relheight=1/self.COL2_ROWS) relx=2/3, rely=2/self.COL2_ROWS, relwidth=1/3, relheight=1/self.COL2_ROWS)
self.options_chunks_Optionmenu.place(x=55, y=-2, width=-85, height=7, self.options_segment_Optionmenu.place(x=55, y=-2, width=-85, height=7,
relx=2/3, rely=3/self.COL2_ROWS, relwidth=1/3, relheight=1/self.COL2_ROWS) relx=2/3, rely=3/self.COL2_ROWS, relwidth=1/3, relheight=1/self.COL2_ROWS)
# Shifts # Shifts
@ -1679,6 +1703,8 @@ class MainWindow(TkinterDnD.Tk):
self.options_algo_Label.place_forget() self.options_algo_Label.place_forget()
self.options_algo_Optionmenu.place_forget() self.options_algo_Optionmenu.place_forget()
self.options_modelFolder_Checkbutton.place_forget() self.options_modelFolder_Checkbutton.place_forget()
self.options_chunks_Label.place_forget()
self.options_chunks_Optionmenu.place_forget()
elif self.aiModel_var.get() == 'Ensemble Mode': elif self.aiModel_var.get() == 'Ensemble Mode':
if self.ensChoose_var.get() == 'Manual Ensemble': if self.ensChoose_var.get() == 'Manual Ensemble':
@ -1740,6 +1766,8 @@ class MainWindow(TkinterDnD.Tk):
self.options_shifts_b_Optionmenu.place_forget() self.options_shifts_b_Optionmenu.place_forget()
self.options_split_Checkbutton.configure(state=tk.DISABLED) self.options_split_Checkbutton.configure(state=tk.DISABLED)
self.options_split_Checkbutton.place_forget() self.options_split_Checkbutton.place_forget()
self.options_segment_Label.place_forget()
self.options_segment_Optionmenu.place_forget()
elif self.ensChoose_var.get() == 'Multi-AI Ensemble': elif self.ensChoose_var.get() == 'Multi-AI Ensemble':
@ -1820,6 +1848,8 @@ class MainWindow(TkinterDnD.Tk):
self.options_shifts_b_Optionmenu.place_forget() self.options_shifts_b_Optionmenu.place_forget()
self.options_split_Checkbutton.configure(state=tk.DISABLED) self.options_split_Checkbutton.configure(state=tk.DISABLED)
self.options_split_Checkbutton.place_forget() self.options_split_Checkbutton.place_forget()
self.options_segment_Label.place_forget()
self.options_segment_Optionmenu.place_forget()
else: else:
# Choose Ensemble # Choose Ensemble
self.options_ensChoose_Label.place(x=0, y=19, width=0, height=-10, self.options_ensChoose_Label.place(x=0, y=19, width=0, height=-10,
@ -1898,6 +1928,8 @@ class MainWindow(TkinterDnD.Tk):
self.options_shifts_b_Optionmenu.place_forget() self.options_shifts_b_Optionmenu.place_forget()
self.options_split_Checkbutton.configure(state=tk.DISABLED) self.options_split_Checkbutton.configure(state=tk.DISABLED)
self.options_split_Checkbutton.place_forget() self.options_split_Checkbutton.place_forget()
self.options_segment_Label.place_forget()
self.options_segment_Optionmenu.place_forget()
if self.inst_only_var.get() == True: if self.inst_only_var.get() == True:
@ -2261,8 +2293,8 @@ class MainWindow(TkinterDnD.Tk):
""" """
top= Toplevel(self) top= Toplevel(self)
top.geometry("670x500") top.geometry("750x500")
window_height = 670 window_height = 750
window_width = 500 window_width = 500
top.title("Advanced Demucs Options") top.title("Advanced Demucs Options")
@ -2304,7 +2336,7 @@ class MainWindow(TkinterDnD.Tk):
l0=tk.Label(frame0, text='Chunks (Set Manually)', font=("Century Gothic", "9"), foreground='#13a4c9') l0=tk.Label(frame0, text='Chunks (Set Manually)', font=("Century Gothic", "9"), foreground='#13a4c9')
l0.grid(row=1,column=0,padx=0,pady=10) l0.grid(row=1,column=0,padx=0,pady=10)
l0=ttk.Entry(frame0, textvariable=self.chunks_var, justify='center') l0=ttk.Entry(frame0, textvariable=self.chunks_d_var, justify='center')
l0.grid(row=2,column=0,padx=0,pady=0) l0.grid(row=2,column=0,padx=0,pady=0)
l0=tk.Label(frame0, text='Chunk Margin', font=("Century Gothic", "9"), foreground='#13a4c9') l0=tk.Label(frame0, text='Chunk Margin', font=("Century Gothic", "9"), foreground='#13a4c9')
@ -2325,26 +2357,32 @@ class MainWindow(TkinterDnD.Tk):
l0=ttk.Entry(frame0, textvariable=self.overlap_b_var, justify='center') l0=ttk.Entry(frame0, textvariable=self.overlap_b_var, justify='center')
l0.grid(row=8,column=0,padx=0,pady=0) l0.grid(row=8,column=0,padx=0,pady=0)
l0=ttk.Checkbutton(frame0, text='Save Stems to Model Name Directory', variable=self.audfile_var) l0=tk.Label(frame0, text='Segment', font=("Century Gothic", "9"), foreground='#13a4c9')
l0.grid(row=9,column=0,padx=0,pady=0) l0.grid(row=9,column=0,padx=0,pady=10)
l0=ttk.Entry(frame0, textvariable=self.segment_var, justify='center')
l0.grid(row=10,column=0,padx=0,pady=0)
l0=ttk.Checkbutton(frame0, text='Save Stems to Model & Track Name Directory', variable=self.audfile_var)
l0.grid(row=11,column=0,padx=0,pady=0)
l0=ttk.Checkbutton(frame0, text='Settings Test Mode', variable=self.modelFolder_var) l0=ttk.Checkbutton(frame0, text='Settings Test Mode', variable=self.modelFolder_var)
l0.grid(row=10,column=0,padx=0,pady=0) l0.grid(row=12,column=0,padx=0,pady=0)
# l0=ttk.Checkbutton(frame0, text='Basic Prediction', variable=self.audfile_var) # l0=ttk.Checkbutton(frame0, text='Basic Prediction', variable=self.audfile_var)
# l0.grid(row=10,column=0,padx=0,pady=0) # l0.grid(row=10,column=0,padx=0,pady=0)
l0=ttk.Button(frame0,text='Open Demucs Model Folder', command=self.open_Modelfolder_de) l0=ttk.Button(frame0,text='Open Demucs Model Folder', command=self.open_Modelfolder_de)
l0.grid(row=11,column=0,padx=0,pady=0) l0.grid(row=13,column=0,padx=0,pady=0)
l0=ttk.Button(frame0,text='Back to Main Menu', command=close_win) l0=ttk.Button(frame0,text='Back to Main Menu', command=close_win)
l0.grid(row=12,column=0,padx=0,pady=10) l0.grid(row=14,column=0,padx=0,pady=10)
def close_win_self(): def close_win_self():
top.destroy() top.destroy()
l0=ttk.Button(frame0,text='Close Window', command=close_win_self) l0=ttk.Button(frame0,text='Close Window', command=close_win_self)
l0.grid(row=13,column=0,padx=0,pady=0) l0.grid(row=15,column=0,padx=0,pady=0)
def advanced_mdx_options(self): def advanced_mdx_options(self):
@ -3435,6 +3473,7 @@ class MainWindow(TkinterDnD.Tk):
'audfile': self.audfile_var.get(), 'audfile': self.audfile_var.get(),
'autocompensate': self.autocompensate_var.get(), 'autocompensate': self.autocompensate_var.get(),
'chunks': chunks, 'chunks': chunks,
'chunks_d': self.chunks_d_var.get(),
'n_fft_scale': self.n_fft_scale_var.get(), 'n_fft_scale': self.n_fft_scale_var.get(),
'segment': self.segment_var.get(), 'segment': self.segment_var.get(),
'dim_f': self.dim_f_var.get(), 'dim_f': self.dim_f_var.get(),

View File

@ -867,7 +867,7 @@ data = {
'export_path': None, 'export_path': None,
'saveFormat': 'Wav', 'saveFormat': 'Wav',
# Processing Options # Processing Options
'demucsmodel': True, 'demucsmodel': False,
'gpu': -1, 'gpu': -1,
'chunks': 10, 'chunks': 10,
'non_red': False, 'non_red': False,

View File

@ -46,23 +46,52 @@ class Predictor():
if data['gpu'] == -1: if data['gpu'] == -1:
device = torch.device('cpu') device = torch.device('cpu')
if data['demucsmodel']: self.demucs = HDemucs(sources=["drums", "bass", "other", "vocals"])
self.demucs = HDemucs(sources=["drums", "bass", "other", "vocals"]) widget_text.write(base_text + 'Loading Demucs model... ')
widget_text.write(base_text + 'Loading Demucs model... ') update_progress(**progress_kwargs,
update_progress(**progress_kwargs, step=0.05)
step=0.05) path_d = Path('models/Demucs_Models')
path_d = Path('models/Demucs_Models') print('What Demucs model was chosen? ', data['DemucsModel'])
print('What Demucs model was chosen? ', data['DemucsModel']) self.demucs = _gm(name=data['DemucsModel'], repo=path_d)
self.demucs = _gm(name=data['DemucsModel'], repo=path_d) widget_text.write('Done!\n')
widget_text.write('Done!\n') if 'UVR' in data['DemucsModel']:
if 'UVR' in data['DemucsModel']: widget_text.write(base_text + "2 stem model selected.\n")
widget_text.write(base_text + "2 stem model selected.\n") if isinstance(self.demucs, BagOfModels):
widget_text.write(base_text + f"Selected model is a bag of {len(self.demucs.models)} models.\n")
if data['segment'] == 'None':
segment = None
if isinstance(self.demucs, BagOfModels): if isinstance(self.demucs, BagOfModels):
widget_text.write(base_text + f"Selected model is a bag of {len(self.demucs.models)} models.\n") if segment is not None:
for sub in self.demucs.models:
sub.segment = segment
else:
if segment is not None:
sub.segment = segment
else:
try:
segment = int(data['segment'])
if isinstance(self.demucs, BagOfModels):
if segment is not None:
for sub in self.demucs.models:
sub.segment = segment
else:
if segment is not None:
sub.segment = segment
widget_text.write(base_text + "Segments set to "f"{segment}.\n")
except:
segment = None
if isinstance(self.demucs, BagOfModels):
if segment is not None:
for sub in self.demucs.models:
sub.segment = segment
else:
if segment is not None:
sub.segment = segment
self.demucs.to(device) self.demucs.to(device)
self.demucs.eval() self.demucs.eval()
update_progress(**progress_kwargs, update_progress(**progress_kwargs,
step=0.1) step=0.1)
@ -536,12 +565,16 @@ class Predictor():
# 1 = demucs only # 1 = demucs only
# 0 = onnx only # 0 = onnx only
if data['chunks'] == 'Full': if data['chunks_d'] == 'Full':
chunk_set = 0 if split_mode == True:
chunk_set = 0
else:
widget_text.write(base_text + "Chunk size set to full... \n")
chunk_set = 0
else: else:
chunk_set = data['chunks'] chunk_set = data['chunks']
if data['chunks'] == 'Auto': if data['chunks_d'] == 'Auto':
if split_mode == True: if split_mode == True:
widget_text.write(base_text + "Split Mode is on (Chunks disabled).\n") widget_text.write(base_text + "Split Mode is on (Chunks disabled).\n")
chunk_set = 0 chunk_set = 0
@ -578,16 +611,13 @@ class Predictor():
if int(sys_mem) >= int(33): if int(sys_mem) >= int(33):
chunk_set = int(0) chunk_set = int(0)
widget_text.write(base_text + 'Chunk size auto-set to Full... \n') widget_text.write(base_text + 'Chunk size auto-set to Full... \n')
elif data['chunks'] == 'Full':
chunk_set = 0
widget_text.write(base_text + "Chunk size set to full... \n")
else: else:
if split_mode == True: if split_mode == True:
widget_text.write(base_text + "Split Mode is on (Chunks disabled).\n") widget_text.write(base_text + "Split Mode is on (Chunks disabled).\n")
chunk_set = 0 chunk_set = 0
else: else:
widget_text.write(base_text + "Split Mode is off (Chunks enabled).\n") widget_text.write(base_text + "Split Mode is off (Chunks enabled).\n")
chunk_set = int(data['chunks']) chunk_set = int(data['chunks_d'])
widget_text.write(base_text + "Chunk size user-set to "f"{chunk_set}... \n") widget_text.write(base_text + "Chunk size user-set to "f"{chunk_set}... \n")
samples = mix.shape[-1] samples = mix.shape[-1]
@ -662,12 +692,13 @@ data = {
# Processing Options # Processing Options
'demucsmodel': True, 'demucsmodel': True,
'gpu': -1, 'gpu': -1,
'chunks': 'Full', 'chunks_d': 'Full',
'modelFolder': False, 'modelFolder': False,
'voc_only_b': False, 'voc_only_b': False,
'inst_only_b': False, 'inst_only_b': False,
'overlap_b': 0.25, 'overlap_b': 0.25,
'shifts_b': 2, 'shifts_b': 2,
'segment': 'None',
'margin': 44100, 'margin': 44100,
'split_mode': False, 'split_mode': False,
'compensate': 1.03597672895, 'compensate': 1.03597672895,
@ -675,7 +706,7 @@ data = {
'DemucsModel': 'mdx_extra', 'DemucsModel': 'mdx_extra',
'audfile': True, 'audfile': True,
} }
default_chunks = data['chunks'] default_chunks = data['chunks_d']
def update_progress(progress_var, total_files, file_num, step: float = 1): def update_progress(progress_var, total_files, file_num, step: float = 1):
"""Calculate the progress for the progress widget in the GUI""" """Calculate the progress for the progress widget in the GUI"""
@ -724,7 +755,7 @@ def main(window: tk.Wm, text_widget: tk.Text, button_widget: tk.Button, progress
global split_mode global split_mode
# Update default settings # Update default settings
default_chunks = data['chunks'] default_chunks = data['chunks_d']
widget_text = text_widget widget_text = text_widget
gui_progress_bar = progress_var gui_progress_bar = progress_var
@ -808,6 +839,23 @@ def main(window: tk.Wm, text_widget: tk.Text, button_widget: tk.Button, progress
shift_set = int(data['shifts_b']) shift_set = int(data['shifts_b'])
split_mode = data['split_mode'] split_mode = data['split_mode']
def determinemusicfileFolderName():
"""
Determine the name that is used for the folder and appended
to the back of the music files
"""
songFolderName = ''
if str(music_file):
songFolderName += os.path.splitext(os.path.basename(music_file))[0]
if songFolderName:
songFolderName = '/' + songFolderName
return songFolderName
def determinemodelFolderName(): def determinemodelFolderName():
""" """
Determine the name that is used for the folder and appended Determine the name that is used for the folder and appended
@ -828,20 +876,26 @@ def main(window: tk.Wm, text_widget: tk.Text, button_widget: tk.Button, progress
if data['audfile'] == True: if data['audfile'] == True:
modelFolderName = determinemodelFolderName() modelFolderName = determinemodelFolderName()
songFolderName = determinemusicfileFolderName()
if modelFolderName: if modelFolderName:
folder_path = f'{data["export_path"]}{modelFolderName}' folder_path = f'{data["export_path"]}{modelFolderName}'
if not os.path.isdir(folder_path): if not os.path.isdir(folder_path):
os.mkdir(folder_path) os.mkdir(folder_path)
if songFolderName:
folder_path = f'{data["export_path"]}{modelFolderName}{songFolderName}'
if not os.path.isdir(folder_path):
os.mkdir(folder_path)
_mixture = f'{data["input_paths"]}' _mixture = f'{data["input_paths"]}'
if data['modelFolder']: if data['modelFolder']:
try: try:
_basename = f'{data["export_path"]}{modelFolderName}/{file_num}_{str(timestampnum)}_{os.path.splitext(os.path.basename(music_file))[0]}' _basename = f'{data["export_path"]}{modelFolderName}{songFolderName}/{file_num}_{str(timestampnum)}_{os.path.splitext(os.path.basename(music_file))[0]}'
except: except:
_basename = f'{data["export_path"]}{modelFolderName}/{file_num}_{str(randomnum)}_{os.path.splitext(os.path.basename(music_file))[0]}' _basename = f'{data["export_path"]}{modelFolderName}{songFolderName}/{file_num}_{str(randomnum)}_{os.path.splitext(os.path.basename(music_file))[0]}'
else: else:
_basename = f'{data["export_path"]}{modelFolderName}/{file_num}_{os.path.splitext(os.path.basename(music_file))[0]}' _basename = f'{data["export_path"]}{modelFolderName}{songFolderName}/{file_num}_{os.path.splitext(os.path.basename(music_file))[0]}'
else: else:
_mixture = f'{data["input_paths"]}' _mixture = f'{data["input_paths"]}'
if data['modelFolder']: if data['modelFolder']:

View File

@ -407,11 +407,11 @@ class Predictor():
if 'UVR' in demucs_model_set: if 'UVR' in demucs_model_set:
sources[3] = (spec_effects(wave=[demucs_out[1],base_out[0]], sources[3] = (spec_effects(wave=[demucs_out[1],base_out[0]],
algorithm=data['mixing'], algorithm=data['mixing'],
value=b[3])*float(data['compensate'])) # compensation value=b[3])*float(compensate)) # compensation
else: else:
sources[3] = (spec_effects(wave=[demucs_out[3],base_out[0]], sources[3] = (spec_effects(wave=[demucs_out[3],base_out[0]],
algorithm=data['mixing'], algorithm=data['mixing'],
value=b[3])*float(data['compensate'])) # compensation value=b[3])*float(compensate)) # compensation
return sources return sources
@ -629,7 +629,7 @@ data = {
'output_image': True, 'output_image': True,
'voc_only': False, 'voc_only': False,
'inst_only': False, 'inst_only': False,
'demucsmodel': True, 'demucsmodel': False,
'chunks': 'auto', 'chunks': 'auto',
'non_red': False, 'non_red': False,
'noisereduc_s': 3, 'noisereduc_s': 3,
@ -643,6 +643,7 @@ data = {
'margin': 44100, 'margin': 44100,
'split_mode': False, 'split_mode': False,
'compensate': 1.03597672895, 'compensate': 1.03597672895,
'autocompensate': True,
'demucs_only': False, 'demucs_only': False,
'mixing': 'Default', 'mixing': 'Default',
'DemucsModel_MDX': 'UVR_Demucs_Model_1', 'DemucsModel_MDX': 'UVR_Demucs_Model_1',
@ -691,7 +692,8 @@ 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 compensate
global autocompensate
global demucs_model_set global demucs_model_set
@ -711,6 +713,7 @@ def main(window: tk.Wm, text_widget: tk.Text, button_widget: tk.Button, progress
# Update default settings # Update default settings
default_chunks = data['chunks'] default_chunks = data['chunks']
default_noisereduc_s = data['noisereduc_s'] default_noisereduc_s = data['noisereduc_s']
autocompensate = data['autocompensate']
widget_text = text_widget widget_text = text_widget
gui_progress_bar = progress_var gui_progress_bar = progress_var
@ -736,8 +739,6 @@ def main(window: tk.Wm, text_widget: tk.Text, button_widget: tk.Button, progress
except: except:
pass pass
n_fft_scale_set=6144
dim_f_set=2048
global nn_arch_sizes global nn_arch_sizes
global nn_architecture global nn_architecture
@ -1322,6 +1323,8 @@ def main(window: tk.Wm, text_widget: tk.Text, button_widget: tk.Button, progress
mdx_ensem = 'UVR_MDXNET_9662' mdx_ensem = 'UVR_MDXNET_9662'
if data['mdx_ensem'] == 'UVR-MDX-NET Karaoke': if data['mdx_ensem'] == 'UVR-MDX-NET Karaoke':
mdx_ensem = 'UVR_MDXNET_KARA' mdx_ensem = 'UVR_MDXNET_KARA'
if data['mdx_ensem'] == 'UVR-MDX-NET Main':
mdx_ensem = 'UVR_MDXNET_Main'
if data['mdx_ensem'] == 'Demucs UVR Model 1': if data['mdx_ensem'] == 'Demucs UVR Model 1':
mdx_ensem = 'UVR_Demucs_Model_1' mdx_ensem = 'UVR_Demucs_Model_1'
if data['mdx_ensem'] == 'Demucs UVR Model 2': if data['mdx_ensem'] == 'Demucs UVR Model 2':
@ -1332,15 +1335,26 @@ def main(window: tk.Wm, text_widget: tk.Text, button_widget: tk.Button, progress
mdx_ensem = 'mdx_extra_q' mdx_ensem = 'mdx_extra_q'
#MDX-Net Model 2 #MDX-Net Model 2
if data['mdx_ensem_b'] == 'UVR-MDX-NET 1': if data['mdx_ensem_b'] == 'UVR-MDX-NET 1':
mdx_ensem_b = 'UVR_MDXNET_1_9703' if os.path.isfile('models/MDX_Net_Models/UVR_MDXNET_1_9703.onnx'):
mdx_ensem_b = 'UVR_MDXNET_1_9703'
else:
mdx_ensem_b = 'UVR_MDXNET_9703'
if data['mdx_ensem_b'] == 'UVR-MDX-NET 2': if data['mdx_ensem_b'] == 'UVR-MDX-NET 2':
mdx_ensem_b = 'UVR_MDXNET_2_9682' if os.path.isfile('models/MDX_Net_Models/UVR_MDXNET_2_9682.onnx'):
mdx_ensem_b = 'UVR_MDXNET_2_9682'
else:
mdx_ensem_b = 'UVR_MDXNET_9682'
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' if os.path.isfile('models/MDX_Net_Models/UVR_MDXNET_3_9662.onnx'):
mdx_ensem_b = 'UVR_MDXNET_3_9662'
else:
mdx_ensem_b = 'UVR_MDXNET_9662'
if data['mdx_ensem_b'] == 'UVR-MDX-NET Karaoke': if data['mdx_ensem_b'] == 'UVR-MDX-NET Karaoke':
mdx_ensem_b = 'UVR_MDXNET_KARA' mdx_ensem_b = 'UVR_MDXNET_KARA'
if data['mdx_ensem_b'] == 'UVR-MDX-NET Main':
mdx_ensem_b = 'UVR_MDXNET_Main'
if data['mdx_ensem_b'] == 'Demucs UVR Model 1': if data['mdx_ensem_b'] == 'Demucs UVR Model 1':
mdx_ensem_b = 'UVR_Demucs_Model_1' mdx_ensem_b = 'UVR_Demucs_Model_1'
if data['mdx_ensem_b'] == 'Demucs UVR Model 2': if data['mdx_ensem_b'] == 'Demucs UVR Model 2':
@ -1351,6 +1365,8 @@ def main(window: tk.Wm, text_widget: tk.Text, button_widget: tk.Button, progress
mdx_ensem_b = 'mdx_extra_q' mdx_ensem_b = 'mdx_extra_q'
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 = [
@ -1544,7 +1560,7 @@ def main(window: tk.Wm, text_widget: tk.Text, button_widget: tk.Button, progress
if data['ensChoose'] == 'Basic VR Ensemble': if data['ensChoose'] == 'Basic VR Ensemble':
loops = Basic_Ensem loops = Basic_Ensem
ensefolder = 'Basic_Ensemble_Outputs' ensefolder = 'Basic_VR_Outputs'
if data['vr_ensem_c'] == 'No Model' and data['vr_ensem_d'] == 'No Model' and data['vr_ensem_e'] == 'No Model': if data['vr_ensem_c'] == 'No Model' and data['vr_ensem_d'] == 'No Model' and data['vr_ensem_e'] == 'No Model':
ensemode = 'Basic_Ensemble' + '_' + vr_ensem_a_name + '_' + vr_ensem_b_name ensemode = 'Basic_Ensemble' + '_' + vr_ensem_a_name + '_' + vr_ensem_b_name
elif data['vr_ensem_c'] == 'No Model' and data['vr_ensem_d'] == 'No Model': elif data['vr_ensem_c'] == 'No Model' and data['vr_ensem_d'] == 'No Model':
@ -1575,7 +1591,7 @@ def main(window: tk.Wm, text_widget: tk.Text, button_widget: tk.Button, progress
ensemode = 'Vocal_Models' ensemode = 'Vocal_Models'
if data['ensChoose'] == 'Multi-AI Ensemble': if data['ensChoose'] == 'Multi-AI Ensemble':
loops = mdx_vr loops = mdx_vr
ensefolder = 'MDX_VR_Ensemble_Outputs' ensefolder = 'Multi_AI_Ensemble_Outputs'
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':
ensemode = 'MDX-Net_Models' ensemode = 'MDX-Net_Models'
elif data['vr_ensem_mdx_a'] == 'No Model' and data['vr_ensem_mdx_b'] == 'No Model' and data['vr_ensem_mdx_c'] == 'No Model': elif data['vr_ensem_mdx_a'] == 'No Model' and data['vr_ensem_mdx_b'] == 'No Model' and data['vr_ensem_mdx_c'] == 'No Model':
@ -1607,6 +1623,13 @@ def main(window: tk.Wm, text_widget: tk.Text, button_widget: tk.Button, progress
step=0) step=0)
try: try:
if float(data['noisereduc_s']) >= 11:
text_widget.write('Error: Noise Reduction only supports values between 0-10.\nPlease set a value between 0-10 (with or without decimals) and try again.')
progress_var.set(0)
button_widget.configure(state=tk.NORMAL) # Enable Button
return
total, used, free = shutil.disk_usage("/") total, used, free = shutil.disk_usage("/")
total_space = int(total/1.074e+9) total_space = int(total/1.074e+9)
@ -2064,12 +2087,24 @@ def main(window: tk.Wm, text_widget: tk.Text, button_widget: tk.Button, progress
modeltype = 'v' modeltype = 'v'
demucs_model_set = data['DemucsModel_MDX'] demucs_model_set = data['DemucsModel_MDX']
noise_pro = 'MDX-NET_Noise_Profile_14_kHz' noise_pro = 'MDX-NET_Noise_Profile_14_kHz'
if autocompensate == True:
compensate = 1.03597672895
else:
compensate = data['compensate']
n_fft_scale_set=6144
dim_f_set=2048
if mdx_name == 'UVR_MDXNET_2_9682': if mdx_name == 'UVR_MDXNET_2_9682':
demucs_only = 'off' demucs_only = 'off'
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' noise_pro = 'MDX-NET_Noise_Profile_14_kHz'
if autocompensate == True:
compensate = 1.03597672895
else:
compensate = data['compensate']
n_fft_scale_set=6144
dim_f_set=2048
if mdx_name == 'UVR_MDXNET_3_9662': if mdx_name == 'UVR_MDXNET_3_9662':
demucs_only = 'off' demucs_only = 'off'
model_set = 'UVR_MDXNET_3_9662.onnx' model_set = 'UVR_MDXNET_3_9662.onnx'
@ -2077,12 +2112,24 @@ def main(window: tk.Wm, text_widget: tk.Text, button_widget: tk.Button, progress
modeltype = 'v' modeltype = 'v'
demucs_model_set = data['DemucsModel_MDX'] demucs_model_set = data['DemucsModel_MDX']
noise_pro = 'MDX-NET_Noise_Profile_14_kHz' noise_pro = 'MDX-NET_Noise_Profile_14_kHz'
if autocompensate == True:
compensate = 1.03597672895
else:
compensate = data['compensate']
n_fft_scale_set=6144
dim_f_set=2048
if mdx_name == 'UVR_MDXNET_KARA': if mdx_name == 'UVR_MDXNET_KARA':
demucs_only = 'off' demucs_only = 'off'
model_set = 'UVR_MDXNET_KARA.onnx' model_set = 'UVR_MDXNET_KARA.onnx'
model_set_name = 'UVR_MDXNET_KARA' model_set_name = 'UVR_MDXNET_KARA'
modeltype = 'v' modeltype = 'v'
noise_pro = 'MDX-NET_Noise_Profile_14_kHz' noise_pro = 'MDX-NET_Noise_Profile_14_kHz'
if autocompensate == True:
compensate = 1.03597672895
else:
compensate = data['compensate']
n_fft_scale_set=6144
dim_f_set=2048
if mdx_name == 'UVR_MDXNET_9703': if mdx_name == 'UVR_MDXNET_9703':
demucs_only = 'off' demucs_only = 'off'
model_set = 'UVR_MDXNET_9703.onnx' model_set = 'UVR_MDXNET_9703.onnx'
@ -2090,6 +2137,12 @@ def main(window: tk.Wm, text_widget: tk.Text, button_widget: tk.Button, progress
modeltype = 'v' modeltype = 'v'
demucs_model_set = data['DemucsModel_MDX'] demucs_model_set = data['DemucsModel_MDX']
noise_pro = 'MDX-NET_Noise_Profile_14_kHz' noise_pro = 'MDX-NET_Noise_Profile_14_kHz'
if autocompensate == True:
compensate = 1.03597672895
else:
compensate = data['compensate']
n_fft_scale_set=6144
dim_f_set=2048
if mdx_name == 'UVR_MDXNET_9682': if mdx_name == 'UVR_MDXNET_9682':
demucs_only = 'off' demucs_only = 'off'
model_set = 'UVR_MDXNET_9682.onnx' model_set = 'UVR_MDXNET_9682.onnx'
@ -2097,6 +2150,12 @@ def main(window: tk.Wm, text_widget: tk.Text, button_widget: tk.Button, progress
modeltype = 'v' modeltype = 'v'
demucs_model_set = data['DemucsModel_MDX'] demucs_model_set = data['DemucsModel_MDX']
noise_pro = 'MDX-NET_Noise_Profile_14_kHz' noise_pro = 'MDX-NET_Noise_Profile_14_kHz'
if autocompensate == True:
compensate = 1.03597672895
else:
compensate = data['compensate']
n_fft_scale_set=6144
dim_f_set=2048
if mdx_name == 'UVR_MDXNET_9662': if mdx_name == 'UVR_MDXNET_9662':
demucs_only = 'off' demucs_only = 'off'
model_set = 'UVR_MDXNET_9662.onnx' model_set = 'UVR_MDXNET_9662.onnx'
@ -2104,6 +2163,12 @@ def main(window: tk.Wm, text_widget: tk.Text, button_widget: tk.Button, progress
modeltype = 'v' modeltype = 'v'
demucs_model_set = data['DemucsModel_MDX'] demucs_model_set = data['DemucsModel_MDX']
noise_pro = 'MDX-NET_Noise_Profile_14_kHz' noise_pro = 'MDX-NET_Noise_Profile_14_kHz'
if autocompensate == True:
compensate = 1.03597672895
else:
compensate = data['compensate']
n_fft_scale_set=6144
dim_f_set=2048
if mdx_name == 'UVR_MDXNET_KARA': if mdx_name == 'UVR_MDXNET_KARA':
demucs_only = 'off' demucs_only = 'off'
model_set = 'UVR_MDXNET_KARA.onnx' model_set = 'UVR_MDXNET_KARA.onnx'
@ -2111,6 +2176,25 @@ def main(window: tk.Wm, text_widget: tk.Text, button_widget: tk.Button, progress
modeltype = 'v' modeltype = 'v'
demucs_model_set = data['DemucsModel_MDX'] demucs_model_set = data['DemucsModel_MDX']
noise_pro = 'MDX-NET_Noise_Profile_14_kHz' noise_pro = 'MDX-NET_Noise_Profile_14_kHz'
if autocompensate == True:
compensate = 1.03597672895
else:
compensate = data['compensate']
n_fft_scale_set=6144
dim_f_set=2048
if mdx_name == 'UVR_MDXNET_Main':
demucs_only = 'off'
model_set = 'UVR_MDXNET_Main.onnx'
model_set_name = 'UVR_MDXNET_Main'
modeltype = 'v'
demucs_model_set = data['DemucsModel_MDX']
noise_pro = 'MDX-NET_Noise_Profile_17_kHz'
if autocompensate == True:
compensate = 1.075
else:
compensate = data['compensate']
n_fft_scale_set=7680
dim_f_set=3072
if 'Demucs' in mdx_name: if 'Demucs' in mdx_name:
demucs_only = 'on' demucs_only = 'on'
demucs_switch = 'on' demucs_switch = 'on'
@ -2527,7 +2611,7 @@ def main(window: tk.Wm, text_widget: tk.Text, button_widget: tk.Button, progress
{ {
'algorithm':'min_mag', 'algorithm':'min_mag',
'model_params':'lib_v5/modelparams/1band_sr44100_hl512.json', 'model_params':'lib_v5/modelparams/1band_sr44100_hl512.json',
'output':'{}_User_Ensembled_(Min Spec)'.format(trackname1), 'output':'{}_Manual_Ensemble_(Min Spec)'.format(trackname1),
'type': 'Instrumentals' 'type': 'Instrumentals'
} }
] ]
@ -2536,7 +2620,7 @@ def main(window: tk.Wm, text_widget: tk.Text, button_widget: tk.Button, progress
{ {
'algorithm':'max_mag', 'algorithm':'max_mag',
'model_params':'lib_v5/modelparams/1band_sr44100_hl512.json', 'model_params':'lib_v5/modelparams/1band_sr44100_hl512.json',
'output': '{}_User_Ensembled_(Max Spec)'.format(trackname1), 'output': '{}_Manual_Ensemble_(Max Spec)'.format(trackname1),
'type': 'Vocals' 'type': 'Vocals'
} }
] ]