Skip to content

Commit

Permalink
Prevent resampling
Browse files Browse the repository at this point in the history
  • Loading branch information
erogol committed Nov 4, 2023
1 parent 331d502 commit 480a6cd
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions TTS/tts/models/xtts.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,8 +377,8 @@ def get_gpt_cond_latents(self, audio, sr, length: int = 3):
sr (int): Sample rate of the audio.
length (int): Length of the audio in seconds. Defaults to 3.
"""

audio_22k = torchaudio.functional.resample(audio, sr, 22050)
if sr != 22050:
audio_22k = torchaudio.functional.resample(audio, sr, 22050)
audio_22k = audio_22k[:, : 22050 * length]
if self.args.gpt_use_perceiver_resampler:
mel = wav_to_mel_cloning(audio_22k,
Expand Down Expand Up @@ -598,6 +598,7 @@ def full_inference(
(gpt_cond_latent, diffusion_conditioning, speaker_embedding) = self.get_conditioning_latents(
audio_path=ref_audio_path, gpt_cond_len=gpt_cond_len, max_ref_length=max_ref_len, sound_norm_refs=sound_norm_refs
)

return self.inference(
text,
language,
Expand Down

0 comments on commit 480a6cd

Please sign in to comment.