mirror of
https://github.com/Anjok07/ultimatevocalremovergui.git
synced 2024-11-24 07:20:10 +01:00
Attempt at fix for #42
This commit is contained in:
parent
15614a14f5
commit
fe4c0073d3
5
.gitignore
vendored
5
.gitignore
vendored
@ -1,5 +1,6 @@
|
||||
__pycache__
|
||||
data.pkl
|
||||
# Testing modules
|
||||
# Testing models
|
||||
model_iter26_sr33075_hl384_w512.pth
|
||||
baseline.pth
|
||||
baseline.pth
|
||||
temp.wav
|
@ -143,18 +143,13 @@ def determineModelFolderName():
|
||||
|
||||
# -Instrumental-
|
||||
if os.path.isfile(data['instrumentalModel']):
|
||||
modelFolderName += os.path.splitext(os.path.basename(data['instrumentalModel']))[0] + '-'
|
||||
modelFolderName += os.path.splitext(os.path.basename(data['instrumentalModel']))[0]
|
||||
# -Vocal-
|
||||
elif os.path.isfile(data['vocalModel']):
|
||||
modelFolderName += os.path.splitext(os.path.basename(data['vocalModel']))[0] + '-'
|
||||
modelFolderName += os.path.splitext(os.path.basename(data['vocalModel']))[0]
|
||||
# -Stack-
|
||||
if os.path.isfile(data['stackModel']):
|
||||
modelFolderName += os.path.splitext(os.path.basename(data['stackModel']))[0]
|
||||
else:
|
||||
modelFolderName = modelFolderName[:-1]
|
||||
|
||||
if modelFolderName:
|
||||
modelFolderName = '/' + modelFolderName
|
||||
modelFolderName += '-' + os.path.splitext(os.path.basename(data['stackModel']))[0]
|
||||
|
||||
return modelFolderName
|
||||
|
||||
@ -327,22 +322,17 @@ def main(window: tk.Wm, text_widget: tk.Text, button_widget: tk.Button, progress
|
||||
sf.write(f'temp.wav',
|
||||
wav_instrument.T, sr)
|
||||
|
||||
appendModelFolderName = modelFolderName.replace('/', '_')
|
||||
# -Save files-
|
||||
# Instrumental
|
||||
if instrumental_name is not None:
|
||||
instrumental_path = '{save_path}/{file_name}.wav'.format(
|
||||
save_path=save_path,
|
||||
file_name=f'{os.path.basename(base_name)}_{instrumental_name}{appendModelFolderName}',
|
||||
)
|
||||
instrumental_path = os.path.join(save_path,
|
||||
f'{os.path.basename(base_name)}_{instrumental_name}_{modelFolderName}.wav')
|
||||
sf.write(instrumental_path,
|
||||
wav_instrument.T, sr)
|
||||
# Vocal
|
||||
if vocal_name is not None:
|
||||
vocal_path = '{save_path}/{file_name}.wav'.format(
|
||||
save_path=save_path,
|
||||
file_name=f'{os.path.basename(base_name)}_{vocal_name}{appendModelFolderName}',
|
||||
)
|
||||
vocal_path = os.path.join(save_path,
|
||||
f'{os.path.basename(base_name)}_{vocal_name}_{modelFolderName}.wav')
|
||||
sf.write(vocal_path,
|
||||
wav_vocals.T, sr)
|
||||
|
||||
@ -376,7 +366,7 @@ def main(window: tk.Wm, text_widget: tk.Text, button_widget: tk.Button, progress
|
||||
models, devices = load_models()
|
||||
modelFolderName = determineModelFolderName()
|
||||
if modelFolderName:
|
||||
folder_path = f'{data["export_path"]}{modelFolderName}'
|
||||
folder_path = os.path.join(data["export_path"], modelFolderName)
|
||||
if not os.path.isdir(folder_path):
|
||||
os.mkdir(folder_path)
|
||||
|
||||
@ -388,7 +378,7 @@ def main(window: tk.Wm, text_widget: tk.Text, button_widget: tk.Button, progress
|
||||
for file_num, music_file in enumerate(data['input_paths'], start=1):
|
||||
try:
|
||||
# Determine File Name
|
||||
base_name = f'{data["export_path"]}{modelFolderName}/{file_num}_{os.path.splitext(os.path.basename(music_file))[0]}'
|
||||
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-
|
||||
@ -483,4 +473,4 @@ def main(window: tk.Wm, text_widget: tk.Text, button_widget: tk.Button, progress
|
||||
text_widget.write(f'Conversion(s) Completed and Saving all Files!\n') # nopep8 Write Command Text
|
||||
text_widget.write(f'Time Elapsed: {time.strftime("%H:%M:%S", time.gmtime(int(time.perf_counter() - stime)))}') # nopep8
|
||||
torch.cuda.empty_cache()
|
||||
button_widget.configure(state=tk.NORMAL) # Enable Button
|
||||
button_widget.configure(state=tk.NORMAL) # Enable Button
|
||||
|
@ -168,6 +168,8 @@ data = {
|
||||
'stackPasses': 0,
|
||||
'stackOnly': False,
|
||||
'saveAllStacked': False,
|
||||
# Model Folder
|
||||
'modelFolder': False,
|
||||
# Constants
|
||||
'sr': 44_100,
|
||||
'hop_length': 1_024,
|
||||
@ -261,18 +263,13 @@ def determineModelFolderName():
|
||||
|
||||
# -Instrumental-
|
||||
if os.path.isfile(data['instrumentalModel']):
|
||||
modelFolderName += os.path.splitext(os.path.basename(data['instrumentalModel']))[0] + '-'
|
||||
modelFolderName += os.path.splitext(os.path.basename(data['instrumentalModel']))[0]
|
||||
# -Vocal-
|
||||
elif os.path.isfile(data['vocalModel']):
|
||||
modelFolderName += os.path.splitext(os.path.basename(data['vocalModel']))[0] + '-'
|
||||
modelFolderName += os.path.splitext(os.path.basename(data['vocalModel']))[0]
|
||||
# -Stack-
|
||||
if os.path.isfile(data['stackModel']):
|
||||
modelFolderName += os.path.splitext(os.path.basename(data['stackModel']))[0]
|
||||
else:
|
||||
modelFolderName = modelFolderName[:-1]
|
||||
|
||||
if modelFolderName:
|
||||
modelFolderName = '/' + modelFolderName
|
||||
modelFolderName += '-' + os.path.splitext(os.path.basename(data['stackModel']))[0]
|
||||
|
||||
return modelFolderName
|
||||
|
||||
@ -341,23 +338,18 @@ def main(window: tk.Wm, text_widget: tk.Text, button_widget: tk.Button, progress
|
||||
sf.write(f'temp.wav',
|
||||
wav_instrument.T, sr)
|
||||
|
||||
appendModelFolderName = modelFolderName.replace('/', '_')
|
||||
# -Save files-
|
||||
# Instrumental
|
||||
if instrumental_name is not None:
|
||||
instrumental_path = '{save_path}/{file_name}.wav'.format(
|
||||
save_path=save_path,
|
||||
file_name=f'{os.path.basename(base_name)}_{instrumental_name}{appendModelFolderName}',
|
||||
)
|
||||
instrumental_path = os.path.join(save_path,
|
||||
f'{os.path.basename(base_name)}_{instrumental_name}_{modelFolderName}.wav')
|
||||
|
||||
sf.write(instrumental_path,
|
||||
wav_instrument.T, sr)
|
||||
# Vocal
|
||||
if vocal_name is not None:
|
||||
vocal_path = '{save_path}/{file_name}.wav'.format(
|
||||
save_path=save_path,
|
||||
file_name=f'{os.path.basename(base_name)}_{vocal_name}{appendModelFolderName}',
|
||||
)
|
||||
vocal_path = os.path.join(save_path,
|
||||
f'{os.path.basename(base_name)}_{vocal_name}_{modelFolderName}.wav')
|
||||
sf.write(vocal_path,
|
||||
wav_vocals.T, sr)
|
||||
|
||||
@ -381,7 +373,7 @@ def main(window: tk.Wm, text_widget: tk.Text, button_widget: tk.Button, progress
|
||||
vocal_remover = VocalRemover(data, text_widget)
|
||||
modelFolderName = determineModelFolderName()
|
||||
if modelFolderName:
|
||||
folder_path = f'{data["export_path"]}{modelFolderName}'
|
||||
folder_path = os.path.join(data["export_path"], modelFolderName)
|
||||
if not os.path.isdir(folder_path):
|
||||
os.mkdir(folder_path)
|
||||
|
||||
@ -392,7 +384,7 @@ def main(window: tk.Wm, text_widget: tk.Text, button_widget: tk.Button, progress
|
||||
for file_num, music_file in enumerate(data['input_paths'], start=1):
|
||||
try:
|
||||
# Determine File Name
|
||||
base_name = f'{data["export_path"]}{modelFolderName}/{file_num}_{os.path.splitext(os.path.basename(music_file))[0]}'
|
||||
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):
|
||||
@ -519,4 +511,4 @@ def main(window: tk.Wm, text_widget: tk.Text, button_widget: tk.Button, progress
|
||||
text_widget.write(f'Conversion(s) Completed and Saving all Files!\n')
|
||||
text_widget.write(f'Time Elapsed: {time.strftime("%H:%M:%S", time.gmtime(int(time.perf_counter() - stime)))}') # nopep8
|
||||
torch.cuda.empty_cache()
|
||||
button_widget.configure(state=tk.NORMAL) # Enable Button
|
||||
button_widget.configure(state=tk.NORMAL) # Enable Button
|
||||
|
Loading…
Reference in New Issue
Block a user