One way to do a square wave:
You need two buzz generators (see Dodge & Jerse, or the Csound source code, for
implementation details). One of the buzz generators runs at the desired square wave
frequency, while the second buzz generator is exactly one octave above this pitch.
Subtract the higher octave buzz generator's output from the lower buzz generator's output
- the result should be a signal with all odd harmonics, all at equal amplitude. Filter the
resultant signal (maybe integrate it). Voila, a bandlimited square wave! Well, I think it
should work...
The one question I have with the above technique is whether it produces a waveform that
truly resembles a square wave in the time domain. Even if the number of harmonics, and the
relative ratio of the harmonics, is identical to an "ideal" bandwidth-limited square wave,
it may have an entirely different waveshape. No big deal, unless the signal is processed
by a nonlinearity, in which case the results of the nonlinear processing will be far
different than the processing of a waveform that has a similar shape to a square wave.