8.2 Issue 2: Discrete samples

8.2 Issue 2: Discrete samples#

Our transform still integrates over a continuous signal \(x(t)\), but digital audio is a sequence of discrete samples \(x[n]\). How do we evaluate an integral when we only have samples? We already confronted this problem in Chapter 6, when we needed to integrate a time-varying frequency to synthesize vibrato. The answer was a Riemann sum: approximate the area under a curve by summing the areas of thin rectangles with width \(\Delta t\) (sampling period) and height corresponding to the complex value at that sample.

Applying a Riemann sum to our windowed transform, we chop the interval \([0, T]\) into \(N\) slices one sample wide, evaluate the integrand at each sample, and sum:

\[\hat{X}(\omega) \approx \sum_{n=0}^{N-1} x[n]\, e^{-j\omega n \Delta t}\, \Delta t, \qquad \text{where } N = T f_s, \;\; \Delta t = \frac{1}{f_s}.\]

The sample spacing \(\Delta t\) appears as a constant multiplier on every term. Since we almost always care about the relative amplitudes across frequencies rather than their absolute scale, we drop the constant \(\Delta t\) and replace equality with proportionality:

\[\hat{X}(\omega) \propto \sum_{n=0}^{N-1} x[n]\, e^{-j\omega n \Delta t}.\]

This resolves the second issue. Our transform is now a finite sum over discrete samples, something a computer can evaluate. But it is still defined for every real \(\omega\), and it would require an infinite amount of compute to enumerate all possible \(\omega\).