How to the FFT analyze a wave in which the components are changing

analysisfftfouriermath

Based on what I've read about Fourier Transforms, it seems that they are designed to work on waves whose components are constant. For example, a simple square wave is

\$\sin(\theta) + 1/3sin(3\theta) + 1/5sin(5\theta)+ 1/7sin(7\theta)\$

However, there are times when a Fourier Transform is used to compute a spectrogram for a file such as a song in which the frequencies that the instruments are playing often change or disappear completely. How does a Fourier Transform know that a given frequency does not exist for a certain period of time? Does it have to break the file down into components and analyze each of those? The presence of time, frequency, and amplitude on a spectrogram suggests that it works, but I don't fully understand how. Thanks in advance for your help.

Best Answer

To create a spectrogram, a signal (e.g audio) is split into segments and then the FFT of each of those segments is computed and then the individual amplitude spectrums of those segments are put side by side.That is why with a spectogram you have both time and frequency components.You might want to see the diagram in THIS post so you can visualise how a spectrogram is produced.