I am implimenting a stft library that uses torch under the hood but uses the parameter conventions of scipy’s ShortTimeFFT. I am having trouble understanding the torch behavior when the stft fft is zero padded and center=False. My basic expectation is zero padding should only change the frequency axis of the output, but the time axis should not change because the data sampling (window and hop) has remained the same.
When center=True this holds, but doesn’t when center=False. Is this behavior expected? Any help is appreciated.
Expect True:
timeseries = torch.randn((8, 2300))
# OK
torch.stft(timeseries, 200, hop_length=100, win_length=200, window=torch.ones(200), return_complex=True).shape[2] == torch.stft(timeseries, 400, hop_length=100, win_length=200, window=torch.ones(200), return_complex=True).shape[2]
# False
torch.stft(timeseries, 200, hop_length=100, win_length=200, window=torch.ones(200), return_complex=True, center=False).shape[2] == torch.stft(timeseries, 400, hop_length=100, win_length=200, window=torch.ones(200), return_complex=True, center=False).shape[2]