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 import wavfile
In [x]: sample_rate, wav =<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


To access solutions, please obtain an access code from Cambridge University Press at the Lecturer Resources page for my book (registration required) and then sign up to providing this code.