This Exercise Set has been submitted for peer review, but it has not yet been accepted for publication in the PICUP collection.

+
Sound and Fourier Transforms

Developed by Michelle Kuchera

This exercise uses sound to understand numerical implementation of Fourier transforms. The Discrete Fourier Transform algorithm is addressed in detail, followed by a comparison with the Fast Fourier Transform algorithm. The exercise is designed as an in-class activity where students can record their own sounds (using whatever software you like, Audacity is an example of free software) and compute the Fourier transforms of their waveforms. The benefit of doing this in the classroom is that students can compare their results with others who created entirely different sounds.
Subject Areas Waves & Optics and Mathematical/Numerical Methods
Level Beyond the First Year
Available Implementation IPython/Jupyter Notebook
Learning Objectives
* Apply numerical integration to the Fourier transform integral to derive the Discrete Fourier Transform (DFT) algorithm (Exercise 1) * Interpret results for different sounds (Exercise 2) * Use the Fast Fourier Transform (FFT) algorithm (built into `numpy`) to compare the DFT and FFT algorithms.
Time to Complete 120 min

These exercises are not tied to a specific programming language. Example implementations are provided under the Code tab, but the Exercises can be implemented in whatever platform you wish to use (e.g., Excel, Python, MATLAB, etc.).

**EXERCISE 1: Derive and code the Discrete Fourier Transform** * Sound data is discrete. Given the continous Fourier Transform equation, how would you discretize the integral so that you can plot $c_k$ vs k? * Implement this algorithm as a function and test it with a function with a known frequency. Play this sound to hear this frequency. * How does $c_k$ relate to frequency? **EXERCISE 2: Use real sound data and interpret results** * Record two different sounds using Audacity. Keep a record of the sampling rate used to record your sound. The smallest sampling rate available recommended to reduce computation time. * Import the sound files into Jupyter and use your DFT function to create a $c_k$ vs. k plot for each sound file. **Note that you will likely have to use a small sample of your data file to compute the DFT in an acceptable amount of time** * Write an interpretation of your results. **EXERCISE 3: Compare your DFT algorithm to the Fast Fourier Transform** * Use the `rfft` function in the `numpy` package to compute the DFT of the three waves used in Exercises 1 and 2. * Compare your results between the two methods. What differences do you observe?

Download Options

Credits and Licensing

The instructor materials are ©2017 Michelle Kuchera.

The exercises are released under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 license

Creative Commons Attribution-NonCommercial-ShareAlike 4.0 license