mirror of
https://github.com/Anjok07/ultimatevocalremovergui.git
synced 2025-02-17 19:19:15 +01:00
Merge pull request #47 from Anjok07/feature-manualConstants
Feature manual constants
This commit is contained in:
commit
a86bfa0501
3
.gitignore
vendored
3
.gitignore
vendored
@ -3,4 +3,5 @@ data.pkl
|
||||
# Testing models
|
||||
model_iter26_sr33075_hl384_w512.pth
|
||||
baseline.pth
|
||||
temp.wav
|
||||
temp.wav
|
||||
models/**/*.pth
|
@ -62,6 +62,7 @@ DEFAULT_DATA = {
|
||||
'modelStackedLabel': '',
|
||||
'aiModel': 'v4',
|
||||
'resType': 'Kaiser Fast',
|
||||
'manType': False,
|
||||
|
||||
'useModel': 'instrumental',
|
||||
'lastDir': None,
|
||||
@ -247,7 +248,7 @@ class MainWindow(TkinterDnD.Tk):
|
||||
PROGRESS_HEIGHT = 26
|
||||
PADDING = 10
|
||||
|
||||
COL1_ROWS = 9
|
||||
COL1_ROWS = 9.5
|
||||
COL2_ROWS = 8.1
|
||||
COL3_ROWS = 5.5
|
||||
|
||||
@ -306,6 +307,7 @@ class MainWindow(TkinterDnD.Tk):
|
||||
self.hopValue_var = tk.StringVar(value=data['hop_length'])
|
||||
self.winSize_var = tk.StringVar(value=data['window_size'])
|
||||
self.nfft_var = tk.StringVar(value=data['n_fft'])
|
||||
self.manType_var = tk.BooleanVar(value=data['manType'])
|
||||
# AI model
|
||||
self.aiModel_var = tk.StringVar(value=data['aiModel'])
|
||||
self.resType_var = tk.StringVar(value=data['resType'])
|
||||
@ -468,6 +470,11 @@ class MainWindow(TkinterDnD.Tk):
|
||||
text='Model Test Mode',
|
||||
variable=self.modelFolder_var,
|
||||
)
|
||||
# Manual Constants
|
||||
self.options_manType_Checkbutton = ttk.Checkbutton(master=self.options_Frame,
|
||||
text='Custom parameters',
|
||||
variable=self.manType_var,
|
||||
)
|
||||
# -Column 2-
|
||||
# SR
|
||||
self.options_sr_Entry = ttk.Entry(master=self.options_Frame,
|
||||
@ -550,6 +557,9 @@ class MainWindow(TkinterDnD.Tk):
|
||||
# Model Folder
|
||||
self.options_modelFolder_Checkbutton.place(x=0, y=0, width=0, height=0,
|
||||
relx=0, rely=7/self.COL1_ROWS, relwidth=1/3, relheight=1/self.COL1_ROWS)
|
||||
# Manual Constants
|
||||
self.options_manType_Checkbutton.place(x=0, y=0, width=0, height=0,
|
||||
relx=0, rely=8/self.COL1_ROWS, relwidth=1/3, relheight=1/self.COL1_ROWS)
|
||||
# -Column 2-
|
||||
# SR
|
||||
self.options_sr_Label.place(x=5, y=4, width=5, height=-8,
|
||||
@ -605,6 +615,8 @@ class MainWindow(TkinterDnD.Tk):
|
||||
lambda *args: self.decode_modelNames())
|
||||
self.stackedModel_var.trace_add('write',
|
||||
lambda *args: self.decode_modelNames())
|
||||
self.manType_var.trace_add('write',
|
||||
lambda *args: self.decode_modelNames())
|
||||
# Model deselect
|
||||
self.aiModel_var.trace_add('write',
|
||||
lambda *args: self.deselect_models())
|
||||
@ -659,7 +671,8 @@ class MainWindow(TkinterDnD.Tk):
|
||||
instrumental = get_model_values(self.instrumentalModel_var.get())
|
||||
stacked = get_model_values(self.stackedModel_var.get())
|
||||
try:
|
||||
if [bool(instrumental), bool(stacked)].count(True) == 2:
|
||||
if ([bool(instrumental), bool(stacked)].count(True) == 2 and
|
||||
not self.manType_var.get()):
|
||||
sr = DEFAULT_DATA['sr']
|
||||
hop_length = DEFAULT_DATA['hop_length']
|
||||
window_size = DEFAULT_DATA['window_size']
|
||||
@ -744,6 +757,8 @@ class MainWindow(TkinterDnD.Tk):
|
||||
'n_fft': n_fft, # not needed for v2
|
||||
# Resolution Type
|
||||
'resType': resType,
|
||||
# Parsed constants should be fixed
|
||||
'manType': self.manType_var.get(),
|
||||
# Other Variables (Tkinter)
|
||||
'window': self,
|
||||
'text_widget': self.command_Text,
|
||||
@ -776,7 +791,14 @@ class MainWindow(TkinterDnD.Tk):
|
||||
|
||||
# Loop through each constant (key) and its widgets
|
||||
for key, (widget, var) in widgetsVars.items():
|
||||
if stacked_selectable:
|
||||
if self.manType_var.get():
|
||||
if str(widget.cget('state')) != 'normal':
|
||||
# Manual typing and widget not enabled
|
||||
widget.configure(state=tk.NORMAL)
|
||||
if '/' in str(var.get()):
|
||||
var.set(var.get().split('/')[0])
|
||||
continue
|
||||
elif stacked_selectable:
|
||||
if instrumental_selectable:
|
||||
if (key in instrumental.keys() and
|
||||
key in stacked.keys()):
|
||||
@ -784,19 +806,17 @@ class MainWindow(TkinterDnD.Tk):
|
||||
widget.configure(state=tk.DISABLED)
|
||||
var.set('%d/%d' % (instrumental[key], stacked[key]))
|
||||
continue
|
||||
else:
|
||||
if key in stacked.keys():
|
||||
# Only stacked selectable
|
||||
widget.configure(state=tk.DISABLED)
|
||||
var.set(stacked[key])
|
||||
continue
|
||||
else:
|
||||
# Stacked model can not be selected
|
||||
if (key in instrumental.keys() and
|
||||
instrumental_selectable):
|
||||
elif key in stacked.keys():
|
||||
# Only stacked selectable
|
||||
widget.configure(state=tk.DISABLED)
|
||||
var.set(instrumental[key])
|
||||
var.set(stacked[key])
|
||||
continue
|
||||
elif (key in instrumental.keys() and
|
||||
instrumental_selectable):
|
||||
# Stacked model can not be selected
|
||||
widget.configure(state=tk.DISABLED)
|
||||
var.set(instrumental[key])
|
||||
continue
|
||||
|
||||
# If widget is already enabled, no need to reset the value
|
||||
if str(widget.cget('state')) != 'normal':
|
||||
@ -959,7 +979,8 @@ class MainWindow(TkinterDnD.Tk):
|
||||
# Get constants
|
||||
instrumental = get_model_values(self.instrumentalModel_var.get())
|
||||
stacked = get_model_values(self.stackedModel_var.get())
|
||||
if [bool(instrumental), bool(stacked)].count(True) == 2:
|
||||
if ([bool(instrumental), bool(stacked)].count(True) == 2 and
|
||||
not self.manType_var.get()):
|
||||
sr = DEFAULT_DATA['sr']
|
||||
hop_length = DEFAULT_DATA['hop_length']
|
||||
window_size = DEFAULT_DATA['window_size']
|
||||
@ -993,6 +1014,7 @@ class MainWindow(TkinterDnD.Tk):
|
||||
'modelStackedLabel': self.stackedModel_var.get(),
|
||||
'aiModel': self.aiModel_var.get(),
|
||||
'resType': self.resType_var.get(),
|
||||
'manType': self.manType_var.get(),
|
||||
})
|
||||
|
||||
self.destroy()
|
||||
|
@ -54,7 +54,9 @@ data = {
|
||||
'window_size': 320,
|
||||
'n_fft': 2_048,
|
||||
# Resolution Type
|
||||
'resType': 'kaiser_fast'
|
||||
'resType': 'kaiser_fast',
|
||||
# Parsed constants should be fixed
|
||||
'manType': False,
|
||||
}
|
||||
default_sr = data['sr']
|
||||
default_hop_length = data['hop_length']
|
||||
@ -94,6 +96,10 @@ def update_constants(model_name):
|
||||
data['window_size'] = default_window_size
|
||||
data['n_fft'] = default_n_fft
|
||||
|
||||
if data['manType']:
|
||||
# Default constants should be fixed
|
||||
return
|
||||
|
||||
for text_part in text_parts:
|
||||
if 'sr' in text_part:
|
||||
text_part = text_part.replace('sr', '')
|
||||
@ -371,6 +377,8 @@ def main(window: tk.Wm, text_widget: tk.Text, button_widget: tk.Button, progress
|
||||
folder_path = os.path.join(data["export_path"], modelFolderName)
|
||||
if not os.path.isdir(folder_path):
|
||||
os.mkdir(folder_path)
|
||||
else:
|
||||
folder_path = ''
|
||||
|
||||
# Determine Loops
|
||||
total_loops = data['stackPasses']
|
||||
@ -378,10 +386,9 @@ def main(window: tk.Wm, text_widget: tk.Text, button_widget: tk.Button, progress
|
||||
total_loops += 1
|
||||
|
||||
for file_num, music_file in enumerate(data['input_paths'], start=1):
|
||||
# Determine File Name
|
||||
base_name = os.path.join(folder_path, f'{file_num}_{os.path.splitext(os.path.basename(music_file))[0]}')
|
||||
try:
|
||||
# Determine File Name
|
||||
base_name = os.path.join(folder_path, f'{file_num}_{os.path.splitext(os.path.basename(music_file))[0]}')
|
||||
|
||||
for loop_num in range(total_loops):
|
||||
# -Determine which model will be used-
|
||||
if not loop_num:
|
||||
|
@ -176,7 +176,9 @@ data = {
|
||||
'window_size': 320,
|
||||
'n_fft': 2_048,
|
||||
# Resolution Type
|
||||
'resType': 'kaiser_fast'
|
||||
'resType': 'kaiser_fast',
|
||||
# Parsed constants should be fixed
|
||||
'manType': False,
|
||||
}
|
||||
default_sr = data['sr']
|
||||
default_hop_length = data['hop_length']
|
||||
@ -214,6 +216,10 @@ def update_constants(model_name):
|
||||
data['window_size'] = default_window_size
|
||||
data['n_fft'] = default_n_fft
|
||||
|
||||
if data['manType']:
|
||||
# Default constants should be fixed
|
||||
return
|
||||
|
||||
for text_part in text_parts:
|
||||
if 'sr' in text_part:
|
||||
text_part = text_part.replace('sr', '')
|
||||
@ -378,16 +384,17 @@ def main(window: tk.Wm, text_widget: tk.Text, button_widget: tk.Button, progress
|
||||
folder_path = os.path.join(data["export_path"], modelFolderName)
|
||||
if not os.path.isdir(folder_path):
|
||||
os.mkdir(folder_path)
|
||||
else:
|
||||
folder_path = ''
|
||||
|
||||
# Determine Loops
|
||||
total_loops = data['stackPasses']
|
||||
if not data['stackOnly']:
|
||||
total_loops += 1
|
||||
for file_num, music_file in enumerate(data['input_paths'], start=1):
|
||||
# Determine File Name
|
||||
base_name = os.path.join(folder_path, f'{file_num}_{os.path.splitext(os.path.basename(music_file))[0]}')
|
||||
try:
|
||||
# Determine File Name
|
||||
base_name = os.path.join(folder_path, f'{file_num}_{os.path.splitext(os.path.basename(music_file))[0]}')
|
||||
|
||||
# --Seperate Music Files--
|
||||
for loop_num in range(total_loops):
|
||||
# -Determine which model will be used-
|
||||
|
@ -1 +0,0 @@
|
||||
Models Go Here
|
@ -1 +0,0 @@
|
||||
Models Go Here
|
@ -1 +0,0 @@
|
||||
Models Go Here
|
@ -1 +0,0 @@
|
||||
Models Go Here
|
Loading…
x
Reference in New Issue
Block a user