Misleading representations of discrete-time signals

Many audio editor tools draw digitally sampled signals in ways that can be misleading or sometimes downright incorrect. I hope this post will be useful in explaining this recurring and confusing issue.

In Audacity 2.0.5, let's set the project sample rate to 48 kHz and generate a sinusoid tone at, say, 22.5 kHz. Using a tone near the Nyquist frequency and a high zoom level will make what I'm talking about quite apparent:

[Image: Detail of an Audacity screenshot, showing its oscillogram viewer zoomed in so much that only a few dozen samples, represented by points in the X-Y plane, are on screen. Adjacent samples are connected to each other by straight lines, and there's a zero-crossing between every sample.]

It appears as though our newly generated sinusoid is "pumping" or going up and down in amplitude! Of course this can't be true; it's just a pure sine wave and should be perfectly reconstructible as such, according to the sampling theorem. But what's happening here?

The problem lies in drawing straight lines between the samples (known as linear interpolation). This overlooks the fact that the original signal – in this case, coming from Audacity's signal generator – only contained frequencies below the Nyquist frequency. Such sharp corners would have been impossible.

A cleaner, more customary way of drawing discrete-time signals is shown below:

[Image: The same samples as in the above screenshot, but instead of connecting adjacent samples to each other, the samples are connected to the X axis using a dotted line.]

Here, only the samples are shown, and their order is discernible from the lines that connect them to the zero level. But we're not trying to claim anything about what's in between those samples (the value is actually undefined).

The "pumping" pattern we're still seeing emerges from the slowly changing phase difference between the sampling frequency and the signal; in other words, the sinusoid is being sampled at different points.

A more faithful representation of the signal can be obtained by low-pass filtering the waveform shown by Audacity – after resampling at a higher rate – using a 'brick-wall' cut-off at the Nyquist frequency. This is equivalent to sinc interpolation, and it's pretty close to what actually happens in the sound card when the signal is played back. We can immediately see how the weird dot pattern was formed:

[Image: The same set of samples as in the above images, but this time, a sinusoid of constant frequency and amplitude is drawn that passes though all the points.]

Sinc interpolation is computationally more complex (slower) than linear interpolation, which is probably why it isn't used by Audacity and others. Some audio editors however, like Cool Edit, do use a better interpolation at high zoom levels.

See also my related post, Rendering PCM with simulated phosphor persistence.

(And since it's been linked so many times – a great episode of Digital Show & Tell explains this and a lot more about sampled signals.)


  1. Are the second and third pictures from Audacity? I was unable to make anything similar using Audacity's low pass filter.

    1. No, they are composite images. You would have to step up the sample rate first. The second picture is just a plot with similar colors.

  2. As an additional mathematical note: The pumping sine wave would be
    sin(w t)*sin(W t)
    where w is the fundamental frequency (close to the sampling rate) and W is the pumping frequency. But this can be rewritten as
    1/2 (Cos((w-W) t) + Cos((w+W) t)).
    If the second term then is above the threshold of the low pass filter, the pumping sine equals the Cos((w-W) t) at the slightly shifted frequency up to stuff eaten by the band pass.

  3. This is amazing! I found your page thru a link on Slashdot, where you decoded GPS data from a helicopter. That is so far above and beyond "Off the GEEK scale" that I just have to stand and applaud... loudly!! :D

    This all reminds me of some Cool Edit "decoding" I did a few years ago. Someone who was into Phone Phreaking liked to make recordings of "Wrong Number" messages from overseas in the 1970's. Back then, most of those calls were relayed via SW radio. One message he posted had a high-pitched "monkey chatter" signal, which I recognized as speech patterns. With a little sleuthing, I determined that it was a single sideband signal, and was exactly 4Khz above the audio. High pass filter, then "ring modulate" the remaining sound with a 4khz sinewave... the voice was a news feed, describing the death of Jim Jones! I e-mailed the guy who posted it, and he was flabbergasted. :) As geeky as this is, I think you've gone far above and beyond. I respectfully bow to the far superior Geek. :)

  4. Lately, I noticed that Audacity draws the samples in the suggested way nowadays. It reminded me of this blog post and I got curious when the change was made. It turned out that this has been the case since 2017, when Audacity 2.2.0 was released. The release notes refer to them as "stem plots" and it is configurable in the preferences, if someone wants the connecting lines back, but why would they? :)


Please browse through the FAQ first, it might be that your question is already answered.

Spammers have even found comments sections, so this comments section is pre-moderated; it will take some time for the comment to show up.