Skip to content

Commit

Permalink
Convert stereo to mono
Browse files Browse the repository at this point in the history
  • Loading branch information
Edresson committed Nov 24, 2023
1 parent fa9bb26 commit 3fc2880
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions TTS/demos/xtts_ft_demo/utils/formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ def format_audio_list(audio_files, target_language="en", out_path=None, buffer=0

for audio_path in tqdm_object:
wav, sr = torchaudio.load(audio_path)
# stereo to mono if needed
if wav.size(0) != 1:
wav = torch.mean(wav, dim=0, keepdim=True)

wav = wav.squeeze()
segments, info = asr_model.transcribe(audio_path, word_timestamps=True, language=target_language)
segments = list(segments)
Expand Down

0 comments on commit 3fc2880

Please sign in to comment.