I've generated this spectrogram using wavelet convolution.

The chirp is generated like so:

framerate = 10000
N = DURATION*framerate
k = np.arange(N)
chirp = sig.chirp(k, 0.01, N, .49)

enter image description here

Each row (linearly representing a frequency) is generated like so: $$row_f = |IFFT(FFT(chirp) * FFT(wavelet_f))|$$ where $f$ represents the frequency.

When I use matplotlib's built in spectrogram tool, I get this image:

enter image description here

L = 100  # length of one segment
overlap = L/2  # overlap between segments
plt.figure(figsize = (10, 5))
plt.specgram(sounddata, NFFT=L, Fs=2, noverlap=overlap, sides='onesided')

In this plot, the line is seemingly cleaner - not blurring over time. Why is the line blurring? I thought wavelet convolution was supposed to have higher resolution than STFT.


1 Answer 1


If you think of the spectrograms as filter banks it might be easier to conceptualize. With a STFT, each bin in the bank has the same time/frequency resolution. With the Wavelet transform, the bins at lower frequencies have higher frequency resolution, which means they must also have lower time resolution. There is an inherent trade off between time and frequency resolution such that one cannot be increased without decreasing the other. This can be thought of intuitively as an impulse in the time domain has an infinitely wide frequency response, or infinitely high resolution in the time domain and zero resolution in the frequency domain.

  • $\begingroup$ This doesn't make sense to me. With STFT, you're using fixed size bins, which would allude to lower frequencies having a lower frequency resolution (because there are less cycles to analyse). In wavelet convolution, no matter what frequency you're at, you analyse a constant amount of cycles (a parameter used during the construction of the wavelet). $\endgroup$ Commented Jul 10, 2020 at 10:09
  • 1
    $\begingroup$ With the STFT, the frequency resolution isn’t lower at lower frequencies, it’s the same at all frequencies. Wavelet bins have constant Q, the ratio of frequency to frequency resolution is constant. $\endgroup$
    – Dan Szabo
    Commented Jul 10, 2020 at 13:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.