Chapter 11 Extra

Write a function playchord that accepts as input the name of a chord (‘A’, ‘Dm’, etc.) and plays that three-note chord back to you as a sound. As we saw in class, a chord and other complex sounds can be understood (synthesized, analyzed) as the sum of pure tones – in this case, the three pure tones representing the three notes of the chord. I suggest you first write a function puretone that takes a frequency and returns the Pt values, so playchord can just call this function three times, add the results and divide by three to avoid clipping.

This page gives you the frequencies for the notes A – G at various octaves (pick a single octave row to work with). This page gives you the ratios for the major and minor chords (as well as some others).

Finally, for a pleasant-sounding chord, make the amplitude taper off, from 1.0 at the beginning to 0.0 at the end. (Hint: use linspace)