Skip to content

Commit

Permalink
Remove unused load_audio function
Browse files Browse the repository at this point in the history
  • Loading branch information
WeberJulian committed Oct 27, 2023
1 parent d4e08c8 commit 1c98821
Showing 1 changed file with 0 additions and 24 deletions.
24 changes: 0 additions & 24 deletions TTS/tts/models/xtts.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,30 +22,6 @@
init_stream_support()


def load_audio(audiopath, sr=22050):
"""
Load an audio file from disk and resample it to the specified sampling rate.
Args:
audiopath (str): Path to the audio file.
sr (int): Target sampling rate.
Returns:
Tensor: Audio waveform tensor with shape (1, T), where T is the number of samples.
"""
audio, sampling_rate = torchaudio.load(audiopath)

if audio.shape[0] > 1:
audio = audio.mean(0, keepdim=True)

if sampling_rate != sr:
resampler = torchaudio.transforms.Resample(sampling_rate, sr)
audio = resampler(audio)

audio = audio.clamp_(-1, 1)
return audio.unsqueeze(0)


def wav_to_mel_cloning(
wav, mel_norms_file="../experiments/clips_mel_norms.pth", mel_norms=None, device=torch.device("cpu")
):
Expand Down

0 comments on commit 1c98821

Please sign in to comment.