Help problem with tone generator

Hello

Im currently doing an experiment on signal aliasing using Audacity. The experiment requires me to create tones of 1kHz-16kHz sampled at 11025 for the first test. It has worked fine from tones 1kHz-5kHz bit when I try to make a tone of 6kHz and over it creates no signal, just a straight line where the signal should be.

Can anyone tell me why this is and how to correct it? Is it a problem with the software?

Cheers

That is what should happen.
The highest frequency that can be represented in a digital (PCM) waveform is half of the sample rate. This is known as the “Nyquist Frequency”, and is the reason that recordings at low sample rates sound dull (Nyquist frequency - Wikipedia).

Cheers Steve

The experiment is on Alias signals tho, is there anyway I can intentionally do it?

Can I get around this? My experiment is on signal aliasing so I need to oversample I little bit

There is no way to represent a signal with a frequency greater than half the sample rate. That is the point of the Shannon Nyquist theorem (Nyquist–Shannon sampling theorem - Wikipedia)
Note that a “theorem” is not the same as a “theory”. A “theory” is a proposed explanation, whereas a “theorem” is a proposed explanation that can be proved from first principles (usually mathematical).

You can “oversample” in the sense that you can record or generate a 6 kHz waveform if you use a sample rate that is greater than 12 kHz. (The Nyquist frequency is half the sample rate), however if you then down sample to 11025 Hz in Audacity the result will be silence because Audacity will resample using an anti-alias filter.

To see the effect of what would happen if there were no anti-alias filter, you need to have an Audacity track that has a sample rate more than 2 x the frequency, and then generate the sample values with no consideration of their “correctness”. The built in generators won’t do this, but Audacity has a built-in programming language that will allow you to do it. The programming language is called “Nyquist” (not entirely a coincidence :wink:)

There are several ways that you can do this.
[Edit: overly complicated example removed - new version to follow]

You can work at the normal sample rate to do the alias experiment.
There’s the “Resample” option in the track menu, but this won’t help you because there’s an anti-aliasing filter integrated. Hence, you have to work with the Nyquist prompt, using a linear interpolation:

(force-srate *sound-srate* (force-srate 2000 s))

The selected track will alias at 1000 Hz if the frequency goes over that limit.
Try a chirp tone and you’ll see–and hear.
Just replace “2000” with the sample rate you like, the current track rate will stay the same.

My first example was overly complicated, so here’s a really simple method.

  1. Open Audacity
  2. Set the “Project Rate” to the required sample rate (for example 11025 Hz). The Project Rate is set in the bottom left corner of the main Audacity window.
  3. Tracks menu > Add New > Audio Track.
  4. Select part of the track and using the Nyquist Prompt, apply this code:
(hzosc 6000)

You can enter whatever frequency you want - in this example a 6000 Hz (6 kHz) sine wave is generated.
If you use the “Debug” button rather than the “OK” button you will see a warning that aliasing will occur.