Fix return_complex warning on training (#1627)
* Fix return_complex warning on training * remove unused prints
This commit is contained in:
parent
0f8a5facd9
commit
78f03e7dc0
@ -38,7 +38,6 @@ def spectral_de_normalize_torch(magnitudes):
|
|||||||
mel_basis = {}
|
mel_basis = {}
|
||||||
hann_window = {}
|
hann_window = {}
|
||||||
|
|
||||||
|
|
||||||
def spectrogram_torch(y, n_fft, sampling_rate, hop_size, win_size, center=False):
|
def spectrogram_torch(y, n_fft, sampling_rate, hop_size, win_size, center=False):
|
||||||
"""Convert waveform into Linear-frequency Linear-amplitude spectrogram.
|
"""Convert waveform into Linear-frequency Linear-amplitude spectrogram.
|
||||||
|
|
||||||
@ -52,11 +51,6 @@ def spectrogram_torch(y, n_fft, sampling_rate, hop_size, win_size, center=False)
|
|||||||
Returns:
|
Returns:
|
||||||
:: (B, Freq, Frame) - Linear-frequency Linear-amplitude spectrogram
|
:: (B, Freq, Frame) - Linear-frequency Linear-amplitude spectrogram
|
||||||
"""
|
"""
|
||||||
# Validation
|
|
||||||
if torch.min(y) < -1.07:
|
|
||||||
logger.debug("min value is %s", str(torch.min(y)))
|
|
||||||
if torch.max(y) > 1.07:
|
|
||||||
logger.debug("max value is %s", str(torch.max(y)))
|
|
||||||
|
|
||||||
# Window - Cache if needed
|
# Window - Cache if needed
|
||||||
global hann_window
|
global hann_window
|
||||||
@ -86,14 +80,13 @@ def spectrogram_torch(y, n_fft, sampling_rate, hop_size, win_size, center=False)
|
|||||||
pad_mode="reflect",
|
pad_mode="reflect",
|
||||||
normalized=False,
|
normalized=False,
|
||||||
onesided=True,
|
onesided=True,
|
||||||
return_complex=False,
|
return_complex=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
# Linear-frequency Linear-amplitude spectrogram :: (B, Freq, Frame, RealComplex=2) -> (B, Freq, Frame)
|
# Linear-frequency Linear-amplitude spectrogram :: (B, Freq, Frame, RealComplex=2) -> (B, Freq, Frame)
|
||||||
spec = torch.sqrt(spec.pow(2).sum(-1) + 1e-6)
|
spec = torch.sqrt(spec.real.pow(2) + spec.imag.pow(2) + 1e-6)
|
||||||
return spec
|
return spec
|
||||||
|
|
||||||
|
|
||||||
def spec_to_mel_torch(spec, n_fft, num_mels, sampling_rate, fmin, fmax):
|
def spec_to_mel_torch(spec, n_fft, num_mels, sampling_rate, fmin, fmax):
|
||||||
# MelBasis - Cache if needed
|
# MelBasis - Cache if needed
|
||||||
global mel_basis
|
global mel_basis
|
||||||
|
Loading…
x
Reference in New Issue
Block a user