Band-limited wavetables and why naive sawtooths alias
Writing a trivial digital sawtooth oscillator takes two lines of code, yet above C5 at 48 kHz metallic inharmonic artifacts creep in because harmonics above fs / 2 fold back into the audible band.
phase += freq / sampleRate;
if (phase >= 1.0) phase -= 1.0;
sample = 2.0 * phase - 1.0;
Precomputing octave-spaced wavetable mip-maps via inverse FFT removes every partial above the Nyquist limit for each pitch range while keeping CPU cost minimal.