- Classic Analog Waveforms
- Waveform Spectra
- Where is the Aliasing?
- Additive Synthesis
- Wavetable Synthesis
- Discrete Summation Formulae (DSF)
- Bandlimited Impulse Train (BLIT) Synthesis
- Generation of Sawtooth, Square, and Triangular Waves from a BLIT

- A number of signals originally used for analog synthesis, including impulse trains, square, sawtooth, and triangular waveforms as shown in Figs. 6 and 7, are also popular in discrete-time synthesis contexts.
- These signals are trivial to synthesize with computers using either an iterative, ``algorithmic'' approach or a wavetable.
- For example, a digital sawtooth waveform of fundamental frequency
*f*can be generated from , where*T*_{s}is the sample period.

- As expected for all periodic sequences, the spectra of these fundamental waveforms are harmonic (see Figs. 6 and 7).
- It is relatively simple to find analytical expressions for these spectra in terms of their Fourier series.
- The Fourier series for a square wave of fundamental frequency
*f*is given by:

- The Fourier series for a sawtooth wave of fundamental frequency
*f*is given by:

- The Fourier series for a triangular wave of fundamental frequency
*f*is given by:

- These expressions indicate that each waveform is composed of an infinite number of harmonically related sinusoids.

- Given the infinite summations of the Fourier series ``recipes'' above, one should expect there to be aliasing in the associated spectra. However, this is not apparent in Figs. 6 and 7.
- It turns out that when the waveform period in samples is an integer, the aliased frequency components ``reflect back'' on top of non-aliased components. The aliasing is happening but it is not obvious in this case.
- In a discrete-time synthesis context, the period
*P*(in samples) for a periodic signal can be determined from its frequency (*f*) as*P*=*f*_{s}/*f*, where*f*_{s}is the sample rate. - As an example, suppose we have a sawtooth waveform with
*P*= 50 and a sample rate*f*_{s}= 44100 Hz. The fundamental, or first partial, frequency of the signal would be 882 Hz. The 25th partial frequency would be 22050 Hz and the 26th partial frequency would be 22932 Hz. This last component, being greater than half the sample rate, would alias back to 21168 Hz, which is the frequency of the 24th partial. - The aliasing in this case is not obvious because no new spectral components result, though there is an associated timbral modification.
- In most synthesis contexts,
*P*is rarely an integer. In order to compute a signal with the correct frequency, it is then necessary to maintain an accurate ``internal'' time index and truncate/round/interpolate it to determine the waveform output at a given time step. - No matter the computational technique used, when
*P*is not an integer, the aliased spectral components will fall between non-aliased components and be clearly perceived, as shown in Fig. 8 for a sawtooth spectrum. - This can also be viewed as the addition of noise to the waveform signal introduced by a pitch-period jitter in the sampling process.

- A relatively simple approach to creating bandlimited versions of the classic analog waveforms previously discussed (or any other complex, periodic waveforms) is to use additive synthesis.
- Each waveform can be formed using appropriated weighted sinusoids (as described by their Fourier series) up to, but not including, the Nyquist frequency.
- Care must be taken when the fundamental frequency is changing in time ... it would be best to gradually fade out the highest component rather than suddenly have it disappear when it reaches fs / 2.
- While additive techniques might seem a bit ``costly'' for this purpose, high-frequency signals will not have that many harmonics less than half the sample rate.

- Though we have mainly discussed the use of wavetables to produce sinusoidal signals, in fact, wavetable techniques can be used to produce much more complex, periodic signals.
- However, wavetable techniques are not guaranteed to be bandlimited when the phase increment is greater than one sample. In such a case, the wavetable operation is equivalent to downsampling which can alias if the frequency content of the wavetable is higher than half the effective downsampled rate.
- It is necessary to know the relative frequency content of a complex wavetable so that an upper bound on the phase increment can be enforced.
- One technique that is used in practice is to use additive techniques to generate multiple sawtooth wavetables an octave apart containing bandlimited harmonics. During synthesis, the necessary wavetables to produce a full, though bandlimited, spectrum are mixed together with appropriate weightings.
- Finally, an impulse train can be generated by differentiating the sawtooth, and a square wave can be produced by adding a sawtooth to another inverted, delayed sawtooth.

- In ``The Synthesis of Complex Audio Spectra by Means of Discrete Summation Formulae'', Moorer (1976) proposed a number of formula for synthesizing bandlimited periodic signals.
- Discrete-Summation Formulae are based on the closed form expression for the geometric series:

- Dodge and Jerse (1985) provide the following formula for the synthesis of a bandlimited impulse train:

- Figure 9 provides a time- and frequency-domain plot demonstrating the use of this formula.
**Figure 9:**The time and frequency magnitude response for an impulse train waveform (440 Hz fundamental and 40 partials) created using the DSF of Dodge & Jerse. - Typically, there are numerical problems when the denominator of these formulae get close to values of zero.
- Dodge and Jerse (1985) provide the following formula for use when the denominator of Eq. (1) gets close to a value of zero:

- Other waveform shapes can be generated from the bandlimited impulse train, as will be described below.

- The ideal anti-aliasing filter, applied to a continuous-time signal before sampling, consists of a rectangular window applied in the frequency domain with a cutoff at half the sample rate.
- The inverse Fourier transform of this filter is a sinc function with a zero-crossing interval of one sample:

- The ideal unit-amplitude impulse train with period
*T*_{1}seconds is given by

- In order to bandlimit the ideal impulse train, we can apply the ideal anti-aliasing filter
*h*_{s}to it as:

where*P*=*T*_{1}/*T*_{s}is the period in samples. - Since
*x*_{f}(*t*) is now bandlimited, it can be sampled without aliasing as

- This infinite summation can be reduced to an expression of the form (Stilson and Smith, 1996)

where the digital sinc function is given by

*M*is the number of harmonics and is always odd. It cannot exceed the period*P*in samples.- Equation (2) is a closed-form expression which can be used to generate a bandlimited impulse train in a manner similar to the use of DSFs.
**Figure 10:**The time and frequency magnitude response of an impulse train waveform (440 Hz fundamental) created using the BLIT sinc function of Stilson & Smith. - Note that similar numerical instabilities will arise with this expression as was found with the DSFs. Using l'Hopital's formula, the the following formula is found for use when the denominator of Eq. (2) gets close to a value of zero:

- Several other classic waveforms can be created from impulse train signals.
- A sawtooth waveform can be created by integrating the combination of a bandlimited impulse train minus a constant obtained by integrating over one period of the impulse train.
- A ``bipolar'' impulse train can be created by adding a time-delayed and inverted BLIT to another BLIT, as shown in Fig. 11.
- Interestingly, a ``bipolar'' impulse train can also be created by using an even value of
*M*in the closed-form BLIT algorithm above. In this case, the frequency of the resulting signal is 1/2 that with an odd*M*, so a frequency scaling is necessary. - A square waveform can be created by integrating a bipolar BLIT.
- Finally, a triangle waveform can be created by integrating the previously computed square wave.
- Integration can be achieved with an IIR filter, though a ``leaky'' integrator should be used to avoid DC offset problems.

©2004-2015 McGill University. All Rights Reserved. Maintained by Gary P. Scavone. |