Implemented Resolution Type option
This commit is contained in:
@@ -61,6 +61,7 @@ DEFAULT_DATA = {
|
|||||||
'modelInstrumentalLabel': '',
|
'modelInstrumentalLabel': '',
|
||||||
'modelStackedLabel': '',
|
'modelStackedLabel': '',
|
||||||
'aiModel': 'v4',
|
'aiModel': 'v4',
|
||||||
|
'resType': 'Kaiser Fast',
|
||||||
|
|
||||||
'useModel': 'instrumental',
|
'useModel': 'instrumental',
|
||||||
'lastDir': None,
|
'lastDir': None,
|
||||||
@@ -240,15 +241,15 @@ class MainWindow(TkinterDnD.Tk):
|
|||||||
# Layout
|
# Layout
|
||||||
IMAGE_HEIGHT = 140
|
IMAGE_HEIGHT = 140
|
||||||
FILEPATHS_HEIGHT = 90
|
FILEPATHS_HEIGHT = 90
|
||||||
OPTIONS_HEIGHT = 240
|
OPTIONS_HEIGHT = 285
|
||||||
CONVERSIONBUTTON_HEIGHT = 35
|
CONVERSIONBUTTON_HEIGHT = 35
|
||||||
COMMAND_HEIGHT = 200
|
COMMAND_HEIGHT = 200
|
||||||
PROGRESS_HEIGHT = 26
|
PROGRESS_HEIGHT = 26
|
||||||
PADDING = 10
|
PADDING = 10
|
||||||
|
|
||||||
COL1_ROWS = 8
|
COL1_ROWS = 9
|
||||||
COL2_ROWS = 7
|
COL2_ROWS = 8.1
|
||||||
COL3_ROWS = 5
|
COL3_ROWS = 5.5
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
# Run the __init__ method on the tk.Tk class
|
# Run the __init__ method on the tk.Tk class
|
||||||
@@ -307,6 +308,7 @@ class MainWindow(TkinterDnD.Tk):
|
|||||||
self.nfft_var = tk.StringVar(value=data['n_fft'])
|
self.nfft_var = tk.StringVar(value=data['n_fft'])
|
||||||
# AI model
|
# AI model
|
||||||
self.aiModel_var = tk.StringVar(value=data['aiModel'])
|
self.aiModel_var = tk.StringVar(value=data['aiModel'])
|
||||||
|
self.resType_var = tk.StringVar(value=data['resType'])
|
||||||
self.last_aiModel = self.aiModel_var.get()
|
self.last_aiModel = self.aiModel_var.get()
|
||||||
# Other
|
# Other
|
||||||
self.inputPathsEntry_var = tk.StringVar(value='')
|
self.inputPathsEntry_var = tk.StringVar(value='')
|
||||||
@@ -398,7 +400,6 @@ class MainWindow(TkinterDnD.Tk):
|
|||||||
text='Save to',
|
text='Save to',
|
||||||
command=self.open_export_filedialog)
|
command=self.open_export_filedialog)
|
||||||
self.filePaths_saveTo_Entry = ttk.Entry(master=self.filePaths_Frame,
|
self.filePaths_saveTo_Entry = ttk.Entry(master=self.filePaths_Frame,
|
||||||
|
|
||||||
textvariable=self.exportPath_var,
|
textvariable=self.exportPath_var,
|
||||||
state=tk.DISABLED
|
state=tk.DISABLED
|
||||||
)
|
)
|
||||||
@@ -492,6 +493,13 @@ class MainWindow(TkinterDnD.Tk):
|
|||||||
self.options_nfft_Label = tk.Label(master=self.options_Frame,
|
self.options_nfft_Label = tk.Label(master=self.options_Frame,
|
||||||
text='N_FFT', anchor=tk.W,
|
text='N_FFT', anchor=tk.W,
|
||||||
background='#63605f', font=self.font, foreground='white', relief="sunken")
|
background='#63605f', font=self.font, foreground='white', relief="sunken")
|
||||||
|
# Resolution Type
|
||||||
|
self.options_resType_Label = tk.Label(master=self.options_Frame,
|
||||||
|
text='Resolution Type', anchor=tk.CENTER,
|
||||||
|
background='#63605f', font=self.font, foreground='white', relief="sunken")
|
||||||
|
self.options_resType_Optionmenu = ttk.OptionMenu(self.options_Frame,
|
||||||
|
self.resType_var,
|
||||||
|
None, 'Kaiser Fast', 'Kaiser Best', 'Scipy')
|
||||||
# AI model
|
# AI model
|
||||||
self.options_aiModel_Label = tk.Label(master=self.options_Frame,
|
self.options_aiModel_Label = tk.Label(master=self.options_Frame,
|
||||||
text='Choose AI Engine', anchor=tk.CENTER,
|
text='Choose AI Engine', anchor=tk.CENTER,
|
||||||
@@ -563,11 +571,16 @@ class MainWindow(TkinterDnD.Tk):
|
|||||||
relx=1/3, rely=3/self.COL2_ROWS, relwidth=1/3/2, relheight=1/self.COL2_ROWS)
|
relx=1/3, rely=3/self.COL2_ROWS, relwidth=1/3/2, relheight=1/self.COL2_ROWS)
|
||||||
self.options_nfft_Entry.place(x=15, y=4, width=5, height=-8,
|
self.options_nfft_Entry.place(x=15, y=4, width=5, height=-8,
|
||||||
relx=1/3 + 1/3/2, rely=3/self.COL2_ROWS, relwidth=1/3/4, relheight=1/self.COL2_ROWS)
|
relx=1/3 + 1/3/2, rely=3/self.COL2_ROWS, relwidth=1/3/4, relheight=1/self.COL2_ROWS)
|
||||||
|
# Resolution Type
|
||||||
|
self.options_resType_Label.place(x=5, y=8, width=-30, height=-8,
|
||||||
|
relx=1/3, rely=4/self.COL2_ROWS, relwidth=1/3, relheight=1/self.COL2_ROWS)
|
||||||
|
self.options_resType_Optionmenu.place(x=5, y=8, width=-30, height=-8,
|
||||||
|
relx=1/3, rely=5/self.COL2_ROWS, relwidth=1/3, relheight=1/self.COL2_ROWS)
|
||||||
# AI model
|
# AI model
|
||||||
self.options_aiModel_Label.place(x=5, y=-5, width=-30, height=-8,
|
self.options_aiModel_Label.place(x=5, y=8, width=-30, height=-8,
|
||||||
relx=1/3, rely=5/self.COL2_ROWS, relwidth=1/3, relheight=1/self.COL2_ROWS)
|
relx=1/3, rely=6/self.COL2_ROWS, relwidth=1/3, relheight=1/self.COL2_ROWS)
|
||||||
self.options_aiModel_Optionmenu.place(x=5, y=-5, width=-30, height=-8,
|
self.options_aiModel_Optionmenu.place(x=5, y=8, width=-30, height=-8,
|
||||||
relx=1/3, rely=6/self.COL2_ROWS, relwidth=1/3, relheight=1/self.COL2_ROWS)
|
relx=1/3, rely=7/self.COL2_ROWS, relwidth=1/3, relheight=1/self.COL2_ROWS)
|
||||||
|
|
||||||
# -Column 3-
|
# -Column 3-
|
||||||
# Choose Model
|
# Choose Model
|
||||||
@@ -641,6 +654,7 @@ class MainWindow(TkinterDnD.Tk):
|
|||||||
input_paths = self.inputPaths
|
input_paths = self.inputPaths
|
||||||
instrumentalModel_path = self.instrumentalLabel_to_path[self.instrumentalModel_var.get()] # nopep8
|
instrumentalModel_path = self.instrumentalLabel_to_path[self.instrumentalModel_var.get()] # nopep8
|
||||||
stackedModel_path = self.stackedLabel_to_path[self.stackedModel_var.get()] # nopep8
|
stackedModel_path = self.stackedLabel_to_path[self.stackedModel_var.get()] # nopep8
|
||||||
|
resType = self.resType_var.get().lower().replace(' ', '_')
|
||||||
# Get constants
|
# Get constants
|
||||||
instrumental = get_model_values(self.instrumentalModel_var.get())
|
instrumental = get_model_values(self.instrumentalModel_var.get())
|
||||||
stacked = get_model_values(self.stackedModel_var.get())
|
stacked = get_model_values(self.stackedModel_var.get())
|
||||||
@@ -728,6 +742,8 @@ class MainWindow(TkinterDnD.Tk):
|
|||||||
'hop_length': hop_length,
|
'hop_length': hop_length,
|
||||||
'window_size': window_size,
|
'window_size': window_size,
|
||||||
'n_fft': n_fft, # not needed for v2
|
'n_fft': n_fft, # not needed for v2
|
||||||
|
# Resolution Type
|
||||||
|
'resType': resType,
|
||||||
# Other Variables (Tkinter)
|
# Other Variables (Tkinter)
|
||||||
'window': self,
|
'window': self,
|
||||||
'text_widget': self.command_Text,
|
'text_widget': self.command_Text,
|
||||||
@@ -976,6 +992,7 @@ class MainWindow(TkinterDnD.Tk):
|
|||||||
'modelInstrumentalLabel': self.instrumentalModel_var.get(),
|
'modelInstrumentalLabel': self.instrumentalModel_var.get(),
|
||||||
'modelStackedLabel': self.stackedModel_var.get(),
|
'modelStackedLabel': self.stackedModel_var.get(),
|
||||||
'aiModel': self.aiModel_var.get(),
|
'aiModel': self.aiModel_var.get(),
|
||||||
|
'resType': self.resType_var.get(),
|
||||||
})
|
})
|
||||||
|
|
||||||
self.destroy()
|
self.destroy()
|
||||||
|
|||||||
@@ -53,6 +53,8 @@ data = {
|
|||||||
'hop_length': 1_024,
|
'hop_length': 1_024,
|
||||||
'window_size': 320,
|
'window_size': 320,
|
||||||
'n_fft': 2_048,
|
'n_fft': 2_048,
|
||||||
|
# Resolution Type
|
||||||
|
'resType': 'kaiser_fast'
|
||||||
}
|
}
|
||||||
default_sr = data['sr']
|
default_sr = data['sr']
|
||||||
default_hop_length = data['hop_length']
|
default_hop_length = data['hop_length']
|
||||||
@@ -206,7 +208,7 @@ def main(window: tk.Wm, text_widget: tk.Text, button_widget: tk.Button, progress
|
|||||||
data['sr'],
|
data['sr'],
|
||||||
False,
|
False,
|
||||||
dtype=np.float32,
|
dtype=np.float32,
|
||||||
res_type='kaiser_fast')
|
res_type=data['resType'])
|
||||||
|
|
||||||
return X, sr
|
return X, sr
|
||||||
|
|
||||||
|
|||||||
@@ -175,6 +175,8 @@ data = {
|
|||||||
'hop_length': 1_024,
|
'hop_length': 1_024,
|
||||||
'window_size': 320,
|
'window_size': 320,
|
||||||
'n_fft': 2_048,
|
'n_fft': 2_048,
|
||||||
|
# Resolution Type
|
||||||
|
'resType': 'kaiser_fast'
|
||||||
}
|
}
|
||||||
default_sr = data['sr']
|
default_sr = data['sr']
|
||||||
default_hop_length = data['hop_length']
|
default_hop_length = data['hop_length']
|
||||||
@@ -428,7 +430,7 @@ def main(window: tk.Wm, text_widget: tk.Text, button_widget: tk.Button, progress
|
|||||||
# Wave source
|
# Wave source
|
||||||
text_widget.write(base_text + 'Loading wave source...\n')
|
text_widget.write(base_text + 'Loading wave source...\n')
|
||||||
X, sr = librosa.load(music_file, data['sr'], False,
|
X, sr = librosa.load(music_file, data['sr'], False,
|
||||||
dtype=np.float32, res_type='kaiser_fast')
|
dtype=np.float32, res_type=data['resType'])
|
||||||
if X.ndim == 1:
|
if X.ndim == 1:
|
||||||
X = np.asarray([X, X])
|
X = np.asarray([X, X])
|
||||||
text_widget.write(base_text + 'Done!\n')
|
text_widget.write(base_text + 'Done!\n')
|
||||||
|
|||||||
Reference in New Issue
Block a user