# Beating effect when generating tone close to Nyquist frequency

Hello there,

I had a couple of questions:

1. I’m generating a sine tone of 3999Hz at a project sample rate of 8kHz. So it is 1Hz less than the Nyquist frequency. I’m curious to know why a beating effect occurs at a rate of 2 times a second. This almost sounds like the acoustical beating effect equivalent to mixing 2 sine signals where one of the signals is 2Hz higher than the other. But what causes something like this to happen?

2. I understand that there are filters with accurate and steep cutoffs at 20KHz when sampled at 44.1kHz. And a 21kHz wave would be accurately represented but with attenuation due to the filter. At what frequency does the cut off start when sampling at 8kHz? Or have I got this completely wrong ?

Thank you!

At what frequency does the cut off start when sampling at 8kHz?

4KHz, but it’s not perfect. When I was learning this stuff in the fourteenth century, we were told you need a sampling frequency of at least 2.6 higher than the highest musical tone to have any hope of recovering the show. If you don’t do that, you can get audible beats between the sampling and the tones.

In actual music you may not hear any problems, but if you insist on applying pure sines to that system, you could very easily get distortions.

As we go.

Koz

That can happen if you have an exact 2X sampling frequency. That output would be data for zero sound. If you missed the sampling by slightly, the data output would drift in and out of being useful. If you really played your cards right, the drift rate could be audible.

Systems are usually filtered to prevent that sort of thing, but again, that’s with music or actual sound, not test signals.

Koz

Here’s another example. As I was making that illustration, the initial Generate > Tone didn’t fit in my display and screen resolution.

The result is apparent modulation. It’s completely made up and doesn’t exist in real life. As I zoom in, the effect vanishes. In effect, the screen resolution becomes multiple times higher than the picture and the distortions vanish.

Koz

@Koz

Thanks for the reply! Yes, sampling at 2.6 times the Nyquist frequency does make sense in the practical world of electronic limitations where we need to accommodate for the ramp of a low pass filter.

For the question: At what frequency does the cut off start when sampling at 8kHz? You mentioned 4kHz. But isn’t this violating the sampling theorem requirement to cut off all frequencies above the Nyquist, since the low pass filter cannot possibly cut off abruptly? Wouldn’t the cut off need to start from, say, 8/2.6 ≈ 3kHz, analogous to how we cut off from 20kHz even though the Nyquist frequency is 22.05kHz when sampled at 44.1kHz?

You also mentioned: The result is apparent modulation. It’s completely made up and doesn’t exist in real life.
But in my case, representing 3.999kHz when sampling at 8kHz, the amplitude modulation is not just visible, but audible as well. Albeit this modulation effect would not be very apparent or dominating for real world signals, I just wanted to understand what phenomenon/artifacting causes this modulation in a control signal.

Regards

It is due to “aliasing” (https://en.wikipedia.org/wiki/Aliasing)
Which version of Audacity are you using?

It “should” be very substantially attenuated by about 3990 Hz. The aim of anti-alias filtering is to maintain as much as possible below the Nyquist frequency (half the sample rate) and as close as possible to zero at the Nyquist frequency. As with most audio apps, Audacity’s anti-aliasing filters are optimised for high quality audio (sample rates of 44100 Hz and above).

In the current development version of Audacity, the anti-alias filters have been tweaked for better performance. The result is that there is less load on the computer from the filtering (faster performance), the roll-off starts a little earlier (more attenuation close to the Nyquist frequency and less aliasing). In Audacity 2.4.0 alpha, with a sample rate of 8000 Hz and highest quality resampling, I see the roll-off occurring from around 3800 Hz and no aliasing at all.

The anti-alias setting can be selected in Preferences: https://manual.audacityteam.org/man/quality_preferences.html
The recommended defaults are shown in the image at the top of that page.