mrfakename ikmalsaid commited on
Commit
56c61e5
1 Parent(s): de3a90d

Implemented a method to convert reference audio to mono prior to processing. (#9)

Browse files

- Implemented a method to convert reference audio to mono prior to processing. (743b1853af53336a366efb48bb1d2ff319717c09)


Co-authored-by: Ikmal Said <ikmalsaid@users.noreply.huggingface.co>

Files changed (1) hide show
  1. app.py +2 -0
app.py CHANGED
@@ -84,6 +84,8 @@ def infer(ref_audio_orig, ref_text, gen_text, exp_name, remove_silence):
84
  gr.Info("Converting audio...")
85
  with tempfile.NamedTemporaryFile(delete=False, suffix=".wav") as f:
86
  aseg = AudioSegment.from_file(ref_audio_orig)
 
 
87
  audio_duration = len(aseg)
88
  if audio_duration > 15000:
89
  gr.Warning("Audio is over 15s, clipping to only first 15s.")
 
84
  gr.Info("Converting audio...")
85
  with tempfile.NamedTemporaryFile(delete=False, suffix=".wav") as f:
86
  aseg = AudioSegment.from_file(ref_audio_orig)
87
+ # Convert to mono
88
+ aseg = aseg.set_channels(1)
89
  audio_duration = len(aseg)
90
  if audio_duration > 15000:
91
  gr.Warning("Audio is over 15s, clipping to only first 15s.")