cwitkowitz commited on
Commit
8cc4dc4
·
1 Parent(s): 3e9e9bc

Added resampling back to original rate.

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -47,12 +47,15 @@ def process_fn(audio_path, de_timbre):
47
  # Normalize audio to [-1, 1]
48
  audio /= audio.abs().max()
49
 
 
 
 
50
  # Create a temporary directory for output
51
  os.makedirs('_outputs', exist_ok=True)
52
  # Create a path for saving the audio
53
  save_path = os.path.join('_outputs', 'output.wav')
54
  # Save the audio
55
- torchaudio.save(save_path, audio, 22050)
56
 
57
  return save_path
58
 
 
47
  # Normalize audio to [-1, 1]
48
  audio /= audio.abs().max()
49
 
50
+ # Resample audio back to the original sampling rate
51
+ audio = torchaudio.functional.resample(audio, 22050, fs)
52
+
53
  # Create a temporary directory for output
54
  os.makedirs('_outputs', exist_ok=True)
55
  # Create a path for saving the audio
56
  save_path = os.path.join('_outputs', 'output.wav')
57
  # Save the audio
58
+ torchaudio.save(save_path, audio, fs)
59
 
60
  return save_path
61