Short-Term Fourier Transform
STFT¶
Signals can be represented in the so called time-frequency-domain. This can be useful for calculations and signal manipulations, as well as for visualization, since this shows the evolution of a signal's spectrum over time. This visual representation is referred to as spectrogram. The short-time Fourier transform (STFT) devides a signal into overlapping segments - or frames - of equal length and calculates a Fourier transform for each frame.
$$ \mathrm{STFT}(i,j) = \sum_{n=-N/2}^{N/2} x[n] w[n] e^{-j 2 \pi f n} $$
Window Function¶
Window functions are used to avoid spectral leakage. In case of the STFT, this can be a hann
Typical framesizes $L_f$ range from $10$ to $40\ \mathrm{ms}$. Overlaps vary from $0$ percent to $90$ percent.
The larger the frames, the better the frequency resolution. The larger the overlap, the better the time resolution.
Violin¶
For musical sounds with a pitch, the spectrogram shows the individual partials as prominent horizontal lines. The following spectrogram of a violin sound, recorded with a sampling rate of $f_s = 96\ \mathrm{kHz}$ is calculated with a framesize of $4096$ samples and an overlap of $2048$ samples: