Skip to content

Commit

Permalink
Simplified fix for encode_mp3
Browse files Browse the repository at this point in the history
  • Loading branch information
adefossez committed Jul 19, 2022
1 parent ce9a04d commit 1c9b9ab
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions demucs/audio.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,7 @@ def encode_mp3(wav, path, samplerate=44100, bitrate=320, verbose=False):
encoder.set_quality(2) # 2-highest, 7-fastest
if not verbose:
encoder.silence()
if 'cuda' in str(wav.device):
wav = wav.cpu()
wav = wav.data.cpu()
wav = wav.transpose(0, 1).numpy()
mp3_data = encoder.encode(wav.tobytes())
mp3_data += encoder.flush()
Expand Down

0 comments on commit 1c9b9ab

Please sign in to comment.