In the following code when I move the mouse above the y-point of the Nyquist frequency (in my case 24000 + 1 Hz) I hear a click, and then the sound goes off, even if I move the mouse to below the Nyquist I hear nothing more. Can some one explain to me why is this happening (same behavior for Saw)?
Some interesting things also happens to the FSinOsc class which I think might be related to the Nyquist and aliasing. Specifically if I move above the Nyquist here the sound sounds something like a Pulse afterwards:
Saw uses a Band-Limited Impulse Train (BLIT) technique – briefly, if you have impulses without any DC offset, then integrating the impulse train produces a sawtooth. Should be easy to find some explanations on YouTube if that sounds confusing (which it probably does).
If the impulses are not band-limited, then the saw won’t be band-limited – but if the impulses are band-limited (which I think can be done by a discrete summation formula), the integral of the band-limited signal will be band-limited, so
The Nyquist frequency is the limit – look up the sinc function (this is a single band-limited impulse) – it oscillates one sample up, one sample down, no way to go faster than that. It’s impossible to exceed the Nyquist frequency in a band-limited oscillator.
Pulse produces its waveform by subtracting a delayed copy of Saw, so it’s subject to the same band limit.
FSinOsc, btw, in its documentation advises against modulating its frequency (which you are doing) – you aren’t guaranteed to get consistent results if you break that rule.