Libosa load

Audio Waveform

To see the content of y we need to plot it. We'll use matplotlib for that

Spectrogram of a sound

A spectrogram is a visual representation of the spectrum of frequencies of a signal as it varies with time.

In a spectrogram, time is in the X-axis and frequencies in the Y-axis

Frequency Spectrum

This is the first step to get to the spectrogram: compute the Discrete Fourier Transform (DFT) on the audio signal so as to decompose the signal into its sine and cosine components (aka, frequencies). However, we compute this DFT in shorter length windows, and thus we call it Short Time Fourier Transform (STFT), and we use librosa's stft function. NOTE: what is returned from librosa is the frequency spectrum in complex values, that is, real and imaginary value pairs... The real values are useful for us, since they are the Amplitudes of the frequencies

Magnitude (aka Amplitude Spectrum)

To make sense of the output of STFT, one thing we can do is calculate the magnitude of the spectrum. This is achieved by computing the absolute value of every element within the spectrum

Plotting a Spectrogram

Power Spectrum... scaled in Decibels

Exercise 1

Define a function to plot a spectrogram given only the audio file name

Exercise 2

Get the spectrograms of 10 files of your choosing and compare them