Live data from Hacker News

Nyquist Frequency

en.wikipedia.org

31–40 of 86 posts

Re: Nyquist Frequency

#31

Earlier quoted context omitted.

This is incorrect, though subtly, and for several different reasons: 1) It is completely possible to create a sawtooth wave that contains only a single frequency. However, you could also consider the wave to be an (infinite) sum of sinusoids at different frequencies. Both views are "correct", and which is more appropriate depends on the context. 2) Related to (1): natural (acoustic) sounds are almost always best cons…

At the "textbook"/"theory" level, the person you are replying to is not wrong. A sawtooth waveform has infinite harmonics. If you were going to be nitpicky (which your response was in that spirit), the best thing to have said (IMO) was that the high frequency harmonics are going to drop off and be below any sort of "noise floor" or sensitivity of the system and not matter anyways. Instead you wrote a bunch of stuff a…

> A sawtooth waveform has infinite harmonics

This is only true if you consider the waveform to be a sine series. As I indicated, this is a perfectly legitimate way to think about a sawtooth (and indeed, it appears to be fundamentally how the human ear works too).

But a sawtooth waveform is also nothing more than a very sharp rise/drop in air pressure followed by a longer drop/rise, repeated over and over again.

If you want to synthesize a sawtooth wavefrom with analog equipment, then thinking of it as an (infinite) sine series makes sense, because that's how you will end up approximating the (perfect) sawtooth.

However, digital synthesis does not require this sort of conception at all, and can be constructed without any summing of a harmonic series.

Also, I find it assuming that in the comments of a post about nyquist, you would write

> a bunch of stuff about sounds and pressure waves that I don't think had the effect you intended. I think you lost the plot somewhere along the way.

What do you the plot is?

Re: Nyquist Frequency

#32

To add another misconception, the Nyquist frequency is a lower bound, below which you necessarily get aliasing. It doesn't say anything about whether said sampling rate is sufficient for reconstruction or whatever your intended use is. E.g. sampling a 1hz signal at 2hz still doesn't tell you if the signal was a 1hz sin or a 1hz sawtooth (depending on how lucky or unlucky you are).

A low pass filter at 2hz would filter out the high frequencies contained in a sawtooth waveform, thus rendering a 1hz sine waveform.

To accurately sample a 1hz sawtooth waveform, you'd have to filter/sample at a much higher frequency.

Re: Nyquist Frequency

#33
Had a great encounter with this recently!

In an environment I work there's multichannel audio recordings that are archived. The archival recordings all had a perfect 4kHz tone appearing, seemingly out of nowhere. This was happening on every channel, across every room, but only in one building. Nowhere else. Absolutely nothing of the sort showed up on live monitoring. The systems were all the same and yet this behaviour was consistent across all systems only at one location.

The full system was reviewed: from processing, recording, signal distribution, audio capture, and in room. Maybe there was a test gen that had accidentally deployed? Nope. Some odd bug in an echo canceller? Also no. Something weird with interference from lighting or power? Slim chance, but also no. Complete mystery.

When looking for acoustic sources there was an odd little blip on the RTA at 20kHz. This was traced back to a test tone emitted from the fire safety system (ultrasonic signal for continuous monitoring). It's inaudible to most people and will be filtered before any voice-to-text processing so no reason for concern. Anyway 20kHz is nowhere near 4kHz though so the search continued.

The dissimilarly of 20kHz and 4kHz is true, until you consider what happens in a non-bandwidth limited signal. The initial capture was taking place at a 48kHz sampling rate. It turns out the archival was downsampling to 24kHz, without applying an anti-aliasing filter. Without filtering, any frequency content above the Nyquist 'folds' back over the reproducible range. So in this case a clean 24kHz bandwidth signal with a little bit of inaudible ultrasonic background noise was being folded at 12kHz to create a very audible 4kHz tone.

It was essentially a capture the flag for signals nerds and a whole lot of fun to trace.

Re: Nyquist Frequency

#34

Earlier quoted context omitted.

At the "textbook"/"theory" level, the person you are replying to is not wrong. A sawtooth waveform has infinite harmonics. If you were going to be nitpicky (which your response was in that spirit), the best thing to have said (IMO) was that the high frequency harmonics are going to drop off and be below any sort of "noise floor" or sensitivity of the system and not matter anyways. Instead you wrote a bunch of stuff a…

> A sawtooth waveform has infinite harmonics This is only true if you consider the waveform to be a sine series. As I indicated, this is a perfectly legitimate way to think about a sawtooth (and indeed, it appears to be fundamentally how the human ear works too). But a sawtooth waveform is also nothing more than a very sharp rise/drop in air pressure followed by a longer drop/rise, repeated over and over again. If yo…

You can’t physically construct a speaker that makes a sawtooth wave. Its cone would need to change velocities from -n to +n or vice-versa instantaneously in order to generate the ‘teeth’ of your wave. The air particles you are moving would likewise need to instantly accelerate. That is a physical impossibility - these things have mass, accelerating them requires force, infinite acceleration requires infinite force.

Those physical constraints manifest as limits on the frequency of sinusoidal harmonics it is possible for you to put into the wave; for the medium to carry; and for you to physically detect at the other end.

Mathematicians don’t break functions down into sinusoidal harmonics because they like trig functions. They do it because they fundamentally are what’s happening.

Re: Nyquist Frequency

#35
post #33

Had a great encounter with this recently! In an environment I work there's multichannel audio recordings that are archived. The archival recordings all had a perfect 4kHz tone appearing, seemingly out of nowhere. This was happening on every channel, across every room, but only in one building. Nowhere else. Absolutely nothing of the sort showed up on live monitoring. The systems were all the same and yet this behavio…

> It turns out the archival was downsampling to 24kHz

But... why?

Re: Nyquist Frequency

#36
post #15

Earlier quoted context omitted.

A 1Hz sawtooth contains frequencies above 1Hz. It actually has frequency components that go out to infinity, so its impossible to perfectly reconstruct a sawtooth without knowing beforehand that its a sawtooth. This is true for any signal with discontinuities (i.e. not "band-limited").

This is incorrect, though subtly, and for several different reasons: 1) It is completely possible to create a sawtooth wave that contains only a single frequency. However, you could also consider the wave to be an (infinite) sum of sinusoids at different frequencies. Both views are "correct", and which is more appropriate depends on the context. 2) Related to (1): natural (acoustic) sounds are almost always best cons…

> It is completely possible to create a sawtooth wave

For a loose definition of "wave". All of the math behind information theory and sampling signals assumes waves are sinusoids. It also happens that waves in nature behave like (dampened) sinusoids. It's a completely natural way to model them mathematically when one has no a prior knowledge of the source, which is what the comment above you is pointing out.

To recognize and then reconstruct a sawtooth with no a priori knowledge, you need to sample much higher than the frequency of the sawtooth. You can compress said information quite well if you have not only wavelets, but sawtooths in your encoding. I am no audio expert but I don't think codecs exploit sawtooths (sawteeth?) for compression because they sound unnatural (because they are).

Note that even digitally you can't create a perfect sawtooth wave because there is a fundamental quantization of time in digital systems. It's a question of, again, how fast you can alter voltages, i.e. a frequency, so you end up generating a step-like function, inescapably. Yeah, sure, you can switch digital systems at MHz or GHz, but still.

Re: Nyquist Frequency

#37

To add another misconception, the Nyquist frequency is a lower bound, below which you necessarily get aliasing. It doesn't say anything about whether said sampling rate is sufficient for reconstruction or whatever your intended use is. E.g. sampling a 1hz signal at 2hz still doesn't tell you if the signal was a 1hz sin or a 1hz sawtooth (depending on how lucky or unlucky you are).

Sampling a 1Hz sawtooth at 2Hz will alias.

Re: Nyquist Frequency

#38

One misconception that many make regarding the Nyquist frequency is thinking that the sampling rate needs to be twice the highest frequency. Your sampling should really really be twice the bandwidth . e.g. your bandwidth is 100 MHz centered at 1 GHz (it needs to actually be bandlimited to 100 MHz**). You do not need to sample at 2.2 GHz. You sample at 200 MSPS (really, you should sample a little more than that, say 2…

Is this assuming you have some analog hardware that's demodulating the signal in front of your ADC? How do you demodulate a signal from a 1GHz carrier with 200 MSPS?

As the sibling comment mentioned, you don’t need to demodulate first, because that is actually what the sampling process of your ADC does.

You can think of it as multiplying the original signal by a comb (in the time domain) of delta functions, which folds everything (in the frequency domain) back into the nyquist frequency of your ADC. Each delta function corresponds to one sample. If your original signal was truly band-limited to 100MHz, then what comes out is a replica of the band limited signal.

One catch (which is actually fairly easy to do in practice) is that the sampling window needs to correspond to around 1/f of the carrier frequency. This is what YakBizzaro is talking about (ADC analog bandwidth) in their sibling post.

Re: Nyquist Frequency

#39

Earlier quoted context omitted.

At the "textbook"/"theory" level, the person you are replying to is not wrong. A sawtooth waveform has infinite harmonics. If you were going to be nitpicky (which your response was in that spirit), the best thing to have said (IMO) was that the high frequency harmonics are going to drop off and be below any sort of "noise floor" or sensitivity of the system and not matter anyways. Instead you wrote a bunch of stuff a…

> A sawtooth waveform has infinite harmonics This is only true if you consider the waveform to be a sine series. As I indicated, this is a perfectly legitimate way to think about a sawtooth (and indeed, it appears to be fundamentally how the human ear works too). But a sawtooth waveform is also nothing more than a very sharp rise/drop in air pressure followed by a longer drop/rise, repeated over and over again. If yo…

> However, digital synthesis does not require this sort of conception at all, and can be constructed without any summing of a harmonic series.

Yes, but you also cannot just make something that goes from -1 to 1 and then wraps back to -1 again, in a discrete-time (sampled) world.

You will get aliasing, because at some point your harmonic series will have partials that are noticeably large and exceed the Nyquist frequency, which will fold back into the output signal's spectrum. And, wouldn't you know it, except for a few very precise frequencies, those aliases will be inharmonic as all hell.

Here's an example (headphone warning - excessively loud) from a daft idea I had to implement a "virtual analogue" synth on an Arduino. Yes, one of the 8-bit ones, that can't do arithmetic.

https://raw.githubusercontent.com/ErroneousBosh/slttblep/mas...

The first sweep is generated with bandlimiting disabled, and you can hear the "swoopy" noises as the aliases slide up and down. The second sweep has some bandlimiting applied by "bending" the points where the signal resets to roughly correspond to a weighted sinc filter, eliminating (most of) the partials above Nyquist.

It uses 16-bit arithmetic on 8-bit lookup tables, and is output through an 8-bit PWM abused as a DAC, so it's not super clean, but it is at least not grossly incorrect.

You cannot filter the synthesized partials that go past Nyquist out after the signal has been generated, because the damage has been done.

Re: Nyquist Frequency

#40
post #33

Had a great encounter with this recently! In an environment I work there's multichannel audio recordings that are archived. The archival recordings all had a perfect 4kHz tone appearing, seemingly out of nowhere. This was happening on every channel, across every room, but only in one building. Nowhere else. Absolutely nothing of the sort showed up on live monitoring. The systems were all the same and yet this behavio…

> It turns out the archival was downsampling to 24kHz But... why?

[deleted]
Post reply on HN