01 / Reading Guide
Reading Guide
Citation
Downey, A. B. (2016). Think DSP: Digital Signal Processing in Python (Version 1.1.4). Green Tea Press. Free official edition: https://greenteapress.com/wp/think-dsp/
Chapter Summary
Chapter 1: Sounds and signals
The opening chapter defines a signal as a quantity that varies in time, using sound as the running example, and introduces spectral decomposition, the discrete Fourier transform (DFT) and the fast Fourier transform (FFT) as the book's central idea, mathematical tool and algorithm. A violin recording is used to explain fundamental frequency, harmonics and timbre. The rest of the chapter introduces the author's thinkdsp module and its three main classes, Signal, Wave and Spectrum, showing how to read and write WAV files, plot waveforms and apply simple low-pass, high-pass and band-stop filters to a spectrum.
Chapter 2: Harmonics
Triangle and square waves are generated in code and their spectrums examined: both contain only odd harmonics, but the harmonics of the triangle wave fall off with the square of frequency, those of the square wave in proportion to frequency. The chapter then deliberately produces a confusing spectrum to introduce aliasing, showing that cosines at 4500 and 5500 Hz sampled at 10,000 frames per second give identical samples, and explains the folding (Nyquist) frequency. It closes by showing how make_spectrum calls NumPy's real FFT and how to read each complex value as an amplitude and a phase offset.
Chapter 3: Non-periodic signals
Moving beyond signals whose frequency content is constant, the chapter builds linear and exponential chirps, explaining along the way that phase is the integral of frequency and that perceived pitch follows the logarithm of frequency. Because the spectrum of a chirp hides when each frequency occurs, the short-time Fourier transform and the spectrogram are introduced. The chapter explains the trade-off between time and frequency resolution (the Gabor limit), spectral leakage caused by treating a finite segment as periodic, and the Hamming window as a remedy, ending with the implementation of make_spectrogram using overlapping windowed segments.
Chapter 4: Noise
This chapter generates and analyses noise, starting with uncorrelated uniform noise and showing through the power spectrum and integrated spectrum that it is white. Brownian (red) noise is built as a random walk, and its power is shown to fall as 1/f² by fitting a line on a log-log plot. Pink noise with a general exponent β, and uncorrelated Gaussian noise (checked with a normal probability plot), complete the family. Exercises apply these ideas to recordings of natural sounds and to Bitcoin price data, and ask readers to implement Bartlett's method and the Voss-McCartney pink-noise algorithm.
Chapter 5: Autocorrelation
Starting from Pearson's correlation coefficient, the chapter defines serial correlation and the autocorrelation function and uses them to make "correlated" and "uncorrelated" precise for the noise signals of Chapter 4, including the long-range dependence of pink noise. Its main application is estimating the pitch of a recorded vocal chirp from the first peak of the autocorrelation, which gives far better frequency precision than reading the spectrum of a short segment. It ends by recasting correlation as a dot product and using NumPy's correlate.
Chapter 6: Discrete cosine transform
Here the book starts explaining how transforms work, using the DCT (used in MP3, JPEG and MPEG compression) as a stepping stone to the DFT. It poses the synthesis problem (amplitudes to signal) and the analysis problem (signal to amplitudes) as linear algebra, first solving a linear system and then showing that choosing times and frequencies carefully makes the synthesis matrix orthogonal (DCT-IV), so that the inverse is just a transpose. The chapter ends with the inverse DCT and the Dct class built on SciPy's DCT-II.
Chapter 7: Discrete Fourier Transform
Following the same synthesis-then-analysis path, the chapter introduces complex exponentials via Euler's formula, complex sinusoids and complex amplitudes, then builds the DFT as multiplication by a unitary matrix whose inverse is its conjugate transpose. It shows that the DFT is periodic in its frequency index and explains, by applying the full DFT to a real sawtooth wave, why the spectrum of a real signal has a mirrored second half, which is why the earlier chapters used rfft. An exercise walks the reader through the Danielson-Lanczos lemma to implement a recursive FFT.
Chapter 8: Filtering and Convolution
Using a 30-day moving average of a stock's daily closing prices and of a square wave, the chapter introduces convolution and shows that smoothing acts as a low-pass filter. This motivates the convolution theorem: convolution in the time domain corresponds to multiplication in the frequency domain. A Gaussian window is compared with the moving-average (boxcar) window to show the effect of sidelobes, and the chapter explains how the FFT makes convolution, cross-correlation and autocorrelation efficient (N log N instead of N²).
Chapter 9: Differentiation and Integration
Continuing the link between windows and filters, this chapter shows that the finite-difference window [1, −1] behaves as a high-pass filter, and that exact differentiation corresponds to multiplying each frequency component by 2πif. Integration correspondingly divides by 2πif, and the cumulative sum approximates it, turning a sawtooth wave into a parabolic signal. The chapter then explains, from the frequency domain, why integrating white noise gives Brownian noise with power proportional to 1/f².
Chapter 10: LTI systems
The theory of signals and systems is introduced through musical acoustics. After defining linear, time-invariant (LTI) systems, the chapter shows that a system's impulse response, and its DFT, the transfer function, fully characterise it: a recorded gunshot is used as the impulse response of a room and applied to a violin recording. Convolution is then interpreted as a sum of shifted, scaled copies of the impulse response, and the chapter closes with a proof of the convolution theorem using complex exponentials.
Chapter 11: Modulation and sampling
The last chapter returns to the aliasing seen in Chapter 2 and explains it. Convolution with impulses creates shifted copies, which explains amplitude modulation and demodulation; sampling is then modelled as multiplication by an impulse train, which makes copies of the spectrum. Using a drum solo recording, the chapter shows when a low-pass filter can remove those copies, introduces the brick-wall filter and its time-domain counterpart, the sinc function, and presents the Nyquist-Shannon sampling theorem informally through these examples.
Key Concepts
Chapter 1: Sounds and signals
- Spectral decomposition: the idea that a signal can be written as a sum of sinusoids with different frequencies, the organising theme of the whole book.
- Signal, Wave and Spectrum: the three
thinkdspclasses representing, respectively, a continuous function of time, that function sampled at discrete frames, and its frequency components. - Fundamental and harmonics: the lowest frequency component, which usually sets the perceived pitch, and its integer multiples, which shape timbre.
Chapter 2: Harmonics
- Harmonic structure: the pattern of which harmonics are present and how fast their amplitudes fall off, which distinguishes triangle, square and sawtooth waves.
- Aliasing: the effect whereby a component above half the sampling rate is indistinguishable, once sampled, from a lower-frequency component.
- Folding frequency: half the sampling rate, about which out-of-range frequencies are reflected back into the measurable range.
Chapter 3: Non-periodic signals
- Chirp: a signal whose frequency changes over time, linearly or exponentially; phase is obtained by integrating frequency.
- Spectrogram: a time-frequency picture built from the spectrums of short, overlapping segments (the short-time Fourier transform).
- Gabor limit: the trade-off that finer frequency resolution requires longer segments and therefore coarser time resolution.
- Leakage and windowing: spurious frequency components caused by the discontinuity at segment edges, reduced by tapering the segment with a window such as Hamming.
Chapter 4: Noise
- White noise: noise with equal power at all frequencies on average, such as uncorrelated uniform or Gaussian noise.
- Brownian (red) noise: noise formed by a random walk, with power proportional to 1/f².
- Pink noise: noise whose power falls as 1/f^β with β between 0 and 2, lying between white and red.
Chapter 5: Autocorrelation
- Serial correlation: the correlation between each value of a signal and the next.
- Autocorrelation function: serial correlation computed as a function of lag, which reveals periodicity and long-range dependence.
- Pitch estimation: finding a periodic signal's fundamental from the lag of the first autocorrelation peak.
Chapter 6: Discrete cosine transform
- Synthesis and analysis problems: going from component amplitudes to a signal and back, framed as matrix multiplication and linear-system solving.
- Orthogonal matrix: a matrix whose inverse equals its transpose, which makes analysis as cheap as synthesis.
- DCT-IV and DCT-II: versions of the discrete cosine transform obtained by particular choices of sample times and frequencies; DCT-II is the common one used in practice.
Chapter 7: Discrete Fourier Transform
- Complex sinusoid: a signal of the form e^{i(2πft+φ)}, a convenient abstraction whose real part is an ordinary sinusoid.
- Unitary synthesis matrix: the DFT matrix, whose inverse is its conjugate transpose, so the DFT and inverse DFT are both matrix multiplications.
- Periodicity and symmetry of the DFT: the DFT repeats every N in its frequency index, and for real signals the upper half mirrors the lower half.
Chapter 8: Filtering and Convolution
- Convolution: sliding a reversed window along a signal and summing products, the general form of operations such as moving averages.
- Convolution theorem: the DFT of a convolution equals the element-wise product of the DFTs.
- Gaussian filter: a smoothing window whose transform is approximately Gaussian, giving a cleaner low-pass filter than a boxcar.
Chapter 9: Differentiation and Integration
- Differentiation filter: multiplication of each component by 2πif, a high-pass filter approximated by the finite difference.
- Integration filter: division by 2πif, approximated by the cumulative sum.
Chapter 10: LTI systems
- Linear, time-invariant system: a system for which scaled sums of inputs give scaled sums of outputs and shifting the input shifts the output.
- Impulse response and transfer function: the output to a single impulse, and its DFT, which together characterise an LTI system.
Chapter 11: Modulation and sampling
- Amplitude modulation: multiplying a signal by a carrier cosine, which shifts copies of its spectrum to higher frequencies.
- Sampling as multiplication by an impulse train: a model showing that sampling replicates the spectrum, which explains aliasing.
- Sampling theorem and sinc interpolation: a band-limited signal sampled faster than twice its highest frequency can be recovered with a brick-wall low-pass filter, equivalent to interpolation with a sinc function.
Critical Analysis
Strengths
- Code-first teaching with real sounds. The preface argues that most signal processing books work bottom-up from abstractions such as phasors, and this book reverses that: every chapter introduces a technique, applies it to recorded signals (a violin, a bell, a vocal chirp, a gunshot, a drum solo) and only then explains how it works. Readers can analyse and generate sounds by the end of Chapter 1.
- Transforms built from linear algebra. Chapters 6 and 7 derive the DCT and DFT by posing synthesis and analysis as matrix problems and then choosing sample points to make the matrix orthogonal or unitary. This gives programmers a concrete route to understanding why the transforms are invertible and why they are fast, rather than presenting the DFT formula as given.
- A coherent set of examples that reappear. Noise from Chapter 4 returns in Chapters 5 and 9, the stock-price series of Chapter 8 is reused for differentiation and integration in Chapter 9, and the aliasing puzzle of Chapter 2 is resolved in Chapter 11. These callbacks show how the ideas connect.
- Open, runnable material. The text is free under a Creative Commons BY-NC-SA licence, and each chapter has a Jupyter notebook and a solutions notebook in the author's GitHub repository, with Binder links for running them without installing anything.
Limitations
- Narrow coverage for a full signals course. There is no z-transform, no Laplace transform, no pole-zero analysis and no systematic design of FIR or IIR filters; continuous-time Fourier analysis appears only informally. Students in a signals-and-systems or control course will need another text for these.
- Informal mathematics. The sampling theorem is illustrated rather than proved, and complex signals are described by the author himself as lacking a satisfying interpretation. Only the convolution theorem gets a proof (Chapter 10).
- Tied to the author's library and dated tooling. Much of the text is written in terms of
thinkdspclasses, and the preface refers to Python 2 and Python 3 compatibility and toscipy.fftpack; readers on current Python stacks may need small adjustments. Some exercise links (for example to price-data sites) may have changed. - Assumes programming fluency. The preface expects core Python and familiarity with objects; readers who are not yet comfortable programming will find the pace uneven.
Applications in the Book
Applications are woven through the chapters rather than collected separately: analysing instrument and voice recordings (Chapters 1–3 and 5), pitch tracking with autocorrelation (Chapter 5), the role of the DCT in audio and image compression (Chapter 6, with a compression exercise), smoothing and differencing a stock-price time series (Chapters 8–9), simulating room acoustics from a gunshot's impulse response (Chapter 10), and amplitude modulation for radio and the sampling of audio at CD and DVD rates (Chapter 11). Exercises add natural noise recordings, Bitcoin prices, Geiger-counter (Poisson) noise and impulse responses from an online acoustics library.
Where It Fits in the Course
In the Signals, Systems and Control course list, Think DSP is the entry point for students who learn best by programming. Sadiku, Ali and Musa's Signals and Systems: A Primer with MATLAB is also, as its title indicates, an introduction to signals and systems with MATLAB; as a dedicated signals-and-systems primer it is likely the closer match to a conventional syllabus, while Think DSP gives intuition for spectra, convolution and sampling through Python experiments. Oppenheim, Willsky and Nawab's Signals and Systems is the natural next step for the formal treatment this book omits, such as continuous-time transforms and the z-transform.
The control and robotics books in the list—Nise's Control Systems Engineering, Åström and Murray's Feedback Systems and Craig's Introduction to Robotics—build on signals-and-systems foundations that Think DSP only touches (it introduces LTI systems and transfer functions in Chapter 10 but not feedback, stability or Laplace-domain design). It is best read before or alongside the main signals text, not instead of it.
How to Use This Book
The book is aimed at programmers and students who know core Python and basic object use, are comfortable with complex numbers, and know what differentiation and integration mean; the preface says linear algebra is explained as it is used. Before starting, clone or download the GitHub repository and run the chapter notebooks locally or on Binder.
Chapters 1–3 are essential and should be read in order; together they give a working vocabulary of spectra, aliasing and spectrograms. Chapters 4 and 5 (noise and autocorrelation) can be shortened for a course focused on systems, but Chapter 5 is useful for audio work. Chapters 6–8 are the conceptual core and should not be skipped: the DCT chapter prepares the DFT chapter, and Chapter 8's convolution theorem underpins Chapters 9–11. For each chapter, read the text with the notebook open, run every example and listen to the sounds, then attempt at least two exercises before checking the provided solution notebook. A one-term elective could cover all eleven chapters at roughly one per week; students using it as a companion to a formal course can read Chapters 1–3, 7, 8, 10 and 11 alongside the corresponding lectures.
Edition and Sources
This guide is based on Think DSP Version 1.1.4 (© 2014 Allen B. Downey, Creative Commons BY-NC-SA 4.0), read as the free PDF linked from the official Green Tea Press page, https://greenteapress.com/wp/think-dsp/; a print edition was published by O'Reilly Media in 2016. It draws on the preface, the full table of contents, and for all eleven chapters the introductions, every section, the worked code examples and the end-of-chapter exercises.
