Before dissecting the Spectrogram, let’s review the fundamental differences between a Spectrogram and a Waveform plot. The Spectrogram graphs show the frequency components of a sound signal over time, focusing on frequency and intensity. In contrast, the Waveforms concentrate on the timing and amplitude of sounds. The difference is in the visual representation of the sound wave. The underlying data representation and the transformation methods are the same.
An audio Spectrogram is another visual representation of a sound wave, and you saw the Waveform graph in Chapter 7. The
_draw_spectrogram() helper method uses the Librosa library to import the audio file and convert it into an amplitude data one-dimensional array and a sampling rate in Hz. The next step is to use the Matplotlib library to draw the Spectrogram plot. Likewise, Pluto takes the output from the Librosa library function and uses the Matplotlib function to draw the fancy blue and yellow Waveform...