Fourier transform of a sound file

Question P6.7.3

The scipy library provides a routine for reading in .wav files as NumPy arrays:

In [x]: from scipy.io import wavfile
In [x]: sample_rate, wav = wavfile.read(<filename>)

For a stereo file, the array wav has shape (n,2) where n is the number of samples.

Use the routines of np.fft to identify the chords present in the sound file chords.wav. Which major chord do they comprise?

The frequencies of musical notes on an equal-tempered scale for which $\mathrm{A_4}=440\;\mathrm{Hz}$ are provided as a dictionary in the file notes.py.


Solution P6.7.3