this is the spectrum of a saw wave played on my synth at a very high frequency. As you can see the harmonics are “bouncing back” at Nyquist’s frequency and going back down, even below the fundamental. This is obviously not ideal and was wondering a good way of going about solving it.
I have seen very little on these forums about antialiasing which surprises me quite a bit.
Yeah I did not mean to imply that it was a problem with juce. However I am surprised there are nto more forum posts discussing this issue, as it seems to be a pretty fundamental problem in dsp.
How did you solve this problem with your synth?
Aliasing is one of the most common issues when working with non-sinusoidal/non-linear systems in DSP and is usually “fixed” by using some kind of oversampling.
Oversampling is not an ideal choice for oscillators, though. Even large oversampling factors might not reduce aliasing enough but the CPU use will be multiplied by the oversampling factor.
For wavetable based oscillators, one approach is to have multiple wavetables for different pitch ranges. (Wavetables for higher note pitches would have less high frequency partials.)
For generating the classic simple synth waveforms (triangles, saws and squares), there are specialized techniques like minBlep.
Yeah after going through some different articles and papers, I think the approach I will take is a combination of MIP MAPs (which is what you’re describing) as it states in this paper:
and also limiting the modulation index for high frequencies.
For example, search oscillators.lib for “Bandlimited Sawtooth”, which defines os.sawN(freqInHz) among other functions. Integrating Faust in JUCE is described at