Stretched spectrogram. The resulting tensor is of the same dtype as the input spectrogram, but the number of frames is changed to ceil(num_frame / rate).
s = torchaudio.transforms.Spectrogram()(x)
s.dtype # => torch.float32
t = torchaudio.transforms.TimeStretch(fixed_rate=0.9)(s)
t.dtype # => torch.complex64
If you haven’t figured this out already…
A complex spectrum contains the phase as well as amplitude of the audio spectral energies.
If your application results are ok with ignoring phase, convert complex to real by using a magnitude function.
If you don’t want to lose the phase information, you will have to keep (and use) the complex spectrum results. Each frequency bin in the spectrum will have a phase according to the ratio of the real vs imaginary value of that bin.