home/ atoms/ digital-oscillator-aliasing

A naive digital sawtooth resets only on sample boundaries, causing aliasing

Analog sawtooth oscillators discharge a capacitor continuously, at the exact instant a threshold is reached. A digital equivalent using a counter-accumulator can only reset on a sample boundary — not at the exact theoretical moment. This misalignment between the desired reset point and the nearest sample creates alias frequencies: spurious tones at wrong pitch positions. The article notes this “won’t give us adequate results without a very high sample rate,” which is why a simple counter cannot substitute for the analog original without additional technique (band-limiting or wavetable lookup). The artifact is most problematic at higher pitches where fewer samples fall within each cycle.

Examples

A 1 kHz sawtooth at 44.1 kHz sample rate has ~44 samples per cycle — the reset lands within one sample of the ideal point. At 10 kHz, only ~4.4 samples per cycle — the reset error is proportionally much larger and aliases are clearly audible.

Assessment

Explain why a simple counter-based digital sawtooth oscillator produces aliasing, and why the problem worsens at higher pitches. What would need to change to eliminate the artifact?

“we can’t “discharge” (reset) it exactly when we want—only on sample boundaries. This results in aliasing”
corpus · a-wavetable-oscillator-introduction-earlevel-engineering · chunk 1