In Search of the Fourth Wave
When I was working on Think DSP, I encountered a small mystery. As you might know:
- A sawtooth wave contains harmonics at integer multiples of the fundamental frequency, and their amplitudes drop off in proportion to 1/f.
- A square wave contains only odd multiples of the fundamental, but they also drop off like 1/f.
- A triangle wave also contains only odd multiples, but they drop off like 1/f².
This pattern suggests that there is a fourth simple waveform that contains all integer multiples (like a sawtooth) and drops off like 1/f² (like a triangle wave). Do you know what it is?
In this talk, I'll suggest three ways we can solve this mystery and show how to compute each of them using Python, NumPy, and SciPy. This talk is appropriate for beginners in both DSP and Python.
What this presentation is about and why it matters
Allan Downey's talk, "In Search of the Fourth Wave," poses a simple, concrete question with surprisingly rich connections: is there a simple periodic waveform that contains every integer harmonic (like a sawtooth) but whose harmonic amplitudes fall off like 1/f^2 (like a triangle wave)? The talk uses this curiosity as a vehicle to explore core DSP ideas—Fourier analysis, synthesis, filtering, sampling, and the link between time-domain operations (integration) and frequency-domain effects (division by f).
Why this matters in practice: understanding how waveform shape controls harmonic content is central to audio synthesis, filter and system design, and noise analysis. Engineers who can move fluently between time and frequency domains can design filters that reshape spectra, synthesize desired tones by summing harmonics, and diagnose artifacts like spectral leakage. The talk is a compact, hands-on illustration of those skills using Python tools you can immediately apply to measurement, sound design, or teaching.
Who will benefit the most from this presentation
- Students and engineers new to DSP who want an approachable, example-driven introduction to Fourier ideas.
- Audio and music technologists interested in how waveform shape determines timbre and how to synthesize custom tones.
- Practitioners who use Python/NumPy/SciPy and want concrete examples of FFTs, inverse FFTs, and spectral shaping in code.
- Teachers looking for a short, reproducible example (Colab notebook) to show time–frequency duality and filtering by example.
What you need to know
The talk is intentionally beginner-friendly, but knowing these basic concepts will help you get more out of it:
- Sampling and discrete time: Signals are represented as sequences sampled at a fixed rate (e.g., 44.1 kHz). The highest representable frequency is the Nyquist frequency: half the sample rate.
- Harmonics and the fundamental: A periodic waveform repeats every T seconds; the fundamental frequency is f0 = 1/T, and harmonics are integer multiples k·f0. The distribution and amplitude of harmonics determine timbre.
- Fourier transform and FFT: The Fourier transform decomposes a time signal into frequency components. In discrete code we use the FFT (and rFFT for real signals) to compute complex amplitudes at discrete frequencies.
- Amplitude roll-off: The amplitude of harmonic k can fall off with frequency. Common fall-offs shown in the talk are proportional to 1/f and 1/f^2. For example, a sawtooth has magnitudes ~1/f, a triangle ~1/f^2.
- Time–frequency duality (integration ↔ division by f): Integrating a time signal corresponds to dividing its Fourier components by frequency. Informally, integrating a sawtooth (which has 1/f amplitudes) yields a waveform whose harmonics go like 1/f^2. You can see this in the frequency domain or approximate it in discrete time via a cumulative sum.
- Synthesis vs. filtering: You can build the same spectrum in two ways: additive synthesis (sum sinusoids with desired amplitudes) or by filtering an existing signal (modify its spectrum and inverse-FFT back to time domain). Both are demonstrated.
- Spectral leakage and windowing: Finite-duration sampling introduces leakage—energy spreads around ideal frequency spikes. That’s why spectra in the talk show small skirts around harmonic peaks.
- Practical code tools: The talk uses NumPy, SciPy, Pandas, and Matplotlib plus Colab. Being comfortable with rfft, rfftfreq, and inverse rFFT is helpful.
Glossary (terms used in this talk)
- Sawtooth wave: A periodic waveform with a linear ramp and abrupt reset; its spectrum contains all integer harmonics with amplitudes that typically fall off approximately as 1/f.
- Square wave: A two-level periodic waveform that contains only odd harmonics, with harmonic amplitudes that typically fall off approximately as 1/f.
- Triangle wave: A piecewise-linear periodic waveform that contains only odd harmonics, with harmonic amplitudes that typically fall off approximately as 1/f^2.
- Harmonic: A sinusoidal component whose frequency is an integer multiple of a signal’s fundamental frequency.
- Fundamental frequency (f0): The lowest nonzero frequency in a periodic signal; all harmonic components are integer multiples of this frequency.
- Fourier transform: A mathematical transform that expresses a signal as a combination of sinusoidal components across frequency.
- FFT (Fast Fourier Transform): An efficient algorithm for computing the discrete Fourier transform.
- rFFT (Real Fast Fourier Transform): A Fourier transform algorithm optimized for real-valued input signals, returning the non-redundant half of the spectrum.
Toolbox (mentioned in this talk)
- NumPy: A foundational Python library for array computing and numerical operations.
- SciPy: A Python library that provides scientific computing algorithms built on NumPy.
- Pandas: A Python library for data manipulation and analysis built around tabular data structures.
- Matplotlib: A Python plotting library used for creating static, animated, and interactive visualizations.
- Google Colab: A cloud-based notebook environment for running Python code in a browser.
Final thoughts
Allan Downey’s talk is a tidy, hands-on demonstration of DSP fundamentals: it frames a small, curious question and uses it to show multiple, equivalent ways of thinking about time and frequency. For learners, the real value is the combination of clear intuition (what the harmonics look like), practical code (rFFT, inverse FFT, synthesis), and a reproducible Colab notebook so you can try variations yourself. If you enjoy concrete examples that connect math to sound and code, this short talk is an excellent way to sharpen intuition about how waveform shape and spectrum relate.
This overview is AI-generated from the session transcript. Spot an issue? Let us know.
Interesting question. I guess that would be the fundamental at 1000 Hz plus harmonics at 2000, 4000, 6000, etc. Not sure what that would look/sound like. I guess that'll be next year's talk.
1 2 4 6 is not the even series, because of the 1
Even would be 2 4 6 which is the same integer ratio as a sawtooth.
If you start at 2, then 2 is the fundamental, and 4, 6, 8 are the even and odd harmonics.
Yes true, unless you said that DC is always the even series fundamental...?
Perhaps you could somehow harness the DC Fourier analysis partial and freq shift it up to hear the even wave or something ? ?
Thanks for the great presentation btw, very interesting.
Nice explanation covering most of the DSP topics
Hello,
Is it possible to have the slides of this presentation? Thanks.
The Jupyter notebook is the slides. I used RISE to display the notebook in slide format. You can run the notebook here: https://tinyurl.com/mysterywave
this is awesome one
Very cool talk! I can't help but point out though, the complex exponential at 23:30 is missing the imaginary constant i or j!
Yes, I noticed that during the playback of the talk. It's fixed now in the slides. Thanks for letting me know!
The sawtooth & square wave spectra fall off as 1/f since the wave has discontinuities in the series itself (in the continuous representation); the spectrum of the triangle wave drops as 1/f^2 since the discontinuities are in the first derivative.
Very enjoyable talk Allen, much appreciated, will check out your blog and your ThinkDSP book.
Why did you pick the parabola-looking wave, instead of the sine-ish looking wave as the representative shape?
No special reason other than the shape was recognizable as a parabola, which led me to Method 3. And then the integration property tells us that the parabola is the integral of the sawtooth.
personally, i'm "partial" to the leaning-sine :)
13:07 sounds distorted
I think we picked up a delayed copy of the wave from my speakers to my mike, so there's some interference.
How about all even harmonics? :)