This commit is contained in:
James Betker 2021-08-14 17:23:15 -06:00
parent 3d2e724083
commit 769f0acc53

View File

@ -88,7 +88,7 @@ class TextMelLoader(torch.utils.data.Dataset):
if sampling_rate != self.input_sample_rate:
if sampling_rate < self.input_sample_rate:
print(f'{filename} has a sample rate of {sampling_rate} which is lower than the requested sample rate of {self.input_sample_rate}. This is not a good idea.')
audio = torch.nn.functional.interpolate(audio.unsqueeze(0).unsqueeze(1), scale_factor=self.input_sample_rate/sampling_rate, mode='area', recompute_scale_factor=False)
audio = torch.nn.functional.interpolate(audio.unsqueeze(0).unsqueeze(1), scale_factor=self.input_sample_rate/sampling_rate, mode='area', recompute_scale_factor=False).squeeze()
if (audio.min() < -1).any() or (audio.max() > 1).any():
print(f"Error with audio ranging for {filename}; min={audio.min()} max={audio.max()}")
return None