Staticaliza commited on
Commit
3b33e09
·
verified ·
1 Parent(s): 5e511c3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -335,9 +335,12 @@ def voice_conversion(input, reference, steps, guidance, speed):
335
  final_audio = butter_bandpass_filter_filtfilt(final_audio)
336
  print("[INFO] | Final audio smoothed with low-pass filter.")
337
 
338
- noise_profile = nr.get_noise_profile(final_audio, sr_current)
339
- final_audio = nr.reduce_noise(y=final_audio, sr=sr_current, y_noise=noise_profile, prop_decrease=1.0)
340
- print("[INFO] | Final audio noise reduced using noisereduce.")
 
 
 
341
 
342
  # Save the audio to a temporary WAV file
343
  print("[INFO] | Saving final audio to a temporary WAV file.")
 
335
  final_audio = butter_bandpass_filter_filtfilt(final_audio)
336
  print("[INFO] | Final audio smoothed with low-pass filter.")
337
 
338
+ noise_duration = 0.5 # in seconds
339
+ noise_sample = final_audio[:int(noise_duration * sr_current)]
340
+
341
+ # Perform noise reduction
342
+ final_audio = nr.reduce_noise(y=final_audio, sr=sr_current, y_noise=noise_sample, prop_decrease=1.0)
343
+ print("[INFO] | Final audio noise reduced using noisereduce with noise sample.")
344
 
345
  # Save the audio to a temporary WAV file
346
  print("[INFO] | Saving final audio to a temporary WAV file.")