Bandlimited waveform generation

Grumpy_Mike:

When producing these digitally, these harmonics are above the nyquist frequency and aliase back into the audio frequency sometimes.

No they don't.
Aliasing only occours when you sample a signal not when you generate it.

Sorry, that is incorrect.

Its perfectly possible to create an aliased signal using DDS to create a waveform (square, sine, or whatever does not matter) and its well known how to avoid this by creating bandlimited signals. The typical way it is done in practice is to use multiple wavetables, such as one per octave, with each table containing progressively less harmonics. Although this can produce audible artifacts on rapid frequency sweeps.

A useful introduction is the paper by Stilson & Smith Alias-Free Digital Synthesis of Classic Analog Waveforms

These lecture notes on bandlimited synthesis are also helpful
http://www.music.mcgill.ca/~gary/307/week5/bandlimited.html

This discussion includes sample code
http://slack.net/~ant/bl-synth/

All of these assume that the analog DDS waveform is being produced by a DAC, rather than messing around with optimistic pulse width modulation hackery.