Skip to content

Commit

Permalink
fix: torchaudio.load/save use .as_posix()
Browse files Browse the repository at this point in the history
"sox_io backend does not handle file-like object"
  • Loading branch information
NextFire committed Nov 23, 2024
1 parent b58a73c commit 45946a5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions yohane-cli/yohane_cli/audio.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ def save_separated_tracks(yohane: Yohane, song_path: Path):
waveform, sample_rate = yohane.vocals
filename = song_path.with_suffix(".vocals.wav")
logger.info(f"Saving vocals track to {filename}")
torchaudio.save(filename, waveform.to("cpu"), sample_rate)
torchaudio.save(filename.as_posix(), waveform.to("cpu"), sample_rate)
if yohane.off_vocal is not None:
waveform, sample_rate = yohane.off_vocal
filename = song_path.with_suffix(".off_vocal.wav")
logger.info(f"Saving off vocal track to {filename}")
torchaudio.save(filename, waveform.to("cpu"), sample_rate)
torchaudio.save(filename.as_posix(), waveform.to("cpu"), sample_rate)
2 changes: 1 addition & 1 deletion yohane/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def off_vocal(self):

def load_song(self, song_file: Path):
logger.info("Loading song")
self.song = torchaudio.load(song_file)
self.song = torchaudio.load(song_file.as_posix())

def extract_vocals(self):
if self.separator is not None:
Expand Down

0 comments on commit 45946a5

Please sign in to comment.