Replace 'return_complex=False'

This commit is contained in:
KamioRinn 2024-07-25 15:29:57 +08:00
parent 29e2fdc62c
commit d93b43b6a8
2 changed files with 9 additions and 9 deletions

View File

@ -68,7 +68,7 @@ def spectrogram_torch(y, n_fft, sampling_rate, hop_size, win_size, center=False)
mode="reflect",
)
y = y.squeeze(1)
spec = torch.stft(
spec = torch.view_as_real(torch.stft(
y,
n_fft,
hop_length=hop_size,
@ -78,8 +78,8 @@ def spectrogram_torch(y, n_fft, sampling_rate, hop_size, win_size, center=False)
pad_mode="reflect",
normalized=False,
onesided=True,
return_complex=False,
)
return_complex=True,
))
spec = torch.sqrt(spec.pow(2).sum(-1) + 1e-6)
return spec
@ -132,7 +132,7 @@ def mel_spectrogram_torch(
)
y = y.squeeze(1)
spec = torch.stft(
spec = torch.view_as_real(torch.stft(
y,
n_fft,
hop_length=hop_size,
@ -142,8 +142,8 @@ def mel_spectrogram_torch(
pad_mode="reflect",
normalized=False,
onesided=True,
return_complex=False,
)
return_complex=True,
))
spec = torch.sqrt(spec.pow(2).sum(-1) + 1e-6)

View File

@ -23,7 +23,7 @@ def spectrogram_torch(y, n_fft, sampling_rate, hop_size, win_size, center=False)
mode="reflect",
)
y = y.squeeze(1)
spec = torch.stft(
spec = torch.view_as_real(torch.stft(
y,
n_fft,
hop_length=hop_size,
@ -33,8 +33,8 @@ def spectrogram_torch(y, n_fft, sampling_rate, hop_size, win_size, center=False)
pad_mode="reflect",
normalized=False,
onesided=True,
return_complex=False,
)
return_complex=True,
))
spec = torch.sqrt(spec.pow(2).sum(-1) + 1e-6)
return spec