Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ldzhangyx committed Jul 28, 2023
1 parent 9a32b33 commit 7bcc344
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions melodytalk/modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,10 @@ def inference(self, inputs):
print(f"{mode} {instrument} track from {music_filename}.")

if mode == "extract":
instrument_mode = instrument
instrument_mode = instrument_mode_file = instrument
elif mode == "remove":
instrument_mode = f"no{instrument}"
instrument_mode_file = f"no_{instrument}"
else:
raise ValueError("mode must be `extract` or `remove`.")

Expand All @@ -234,13 +235,13 @@ def inference(self, inputs):
demucs.separate.main(self.params_list)
# rename
copyfile(
os.path.join("separated", "htdemucs_6s", music_filename[:-4].split("/")[-1],f"{instrument_mode}.wav"),
os.path.join("separated", "htdemucs_6s", music_filename[:-4].split("/")[-1],f"{instrument_mode_file}.wav"),
updated_music_filename
)
# delete the folder
# os.system(f"rm -rf {os.path.join('separated', 'htdemucs_6s')}")

print(f"Processed Source Separation, Input Music: {music_filename}, Output Instrument: {instrument_mode}.")
print(f"Processed Source Separation, Input Music: {music_filename}, Output Instrument: {instrument_mode_file}.")
return updated_music_filename


Expand Down

0 comments on commit 7bcc344

Please sign in to comment.