13 Analyzing sound waves with a Fourier series

 

This chapter covers

  • Defining and playing sound waves with Python and PyGame
  • Turning sinusoidal functions into playable musical notes
  • Combining two sounds by adding their sound waves as functions
  • Decomposing a sound wave function into its Fourier series to see its musical notes

For a lot of part 2, we’ve focused on using calculus to simulate moving objects. In this chapter, I’ll show you a completely different application: working with audio data. Digital audio data is a computer representation of sound waves, which are repeating changes of pressure in the air that our ears perceive as sound. We’ll think of sound waves as functions that we can add and scale as vectors, and then we can use integrals to understand what kinds of sounds they represent. As a result, our exploration of sound waves combines a lot of what you’ve learned about both linear algebra and calculus in earlier chapters.

13.1 Combining sound waves and decomposing them

13.2 Playing sound waves in Python

13.2.1 Producing our first sound

13.2.2 Playing a musical note

13.2.3 Exercises

13.3 Turning a sinusoidal wave into a sound

13.3.1 Making audio from sinusoidal functions

13.3.2 Changing the frequency of a sinusoid

13.3.3 Sampling and playing the sound wave

13.3.4 Exercises

13.4 Combining sound waves to make new ones

13.4.1 Adding sampled sound waves to build a chord

13.4.2 Picturing the sum of two sound waves

13.4.3 Building a linear combination of sinusoids

13.4.4 Building a familiar function with sinusoids

13.4.5 Exercises