Waveform Reference for Sound-Synthesis

Overview

This page enumerates waveform families which can be used for digital sound synthesis. Several of these waveforms (sine, sawtooth, square, triangle, pulse) were selectable options on the original analog tone generators. Sample tones have been provided for each waveform graph.

When this page was originally posted, my intent was to make sound synthesis accessible to all through Java applets, which included an Orchestra Editor, a Note-List Editor, and a Wave-file viewer. Since browers have now withdrawn support for applet technology I have had to fall back to a desktop application. For those with access to this application, I have prepared an orchestra file, WaveformOrch.xml. This file contains most of the waveforms graphed on this page (excepting rectangle waves, for reasons explained below). The file also defines a simple oscillator instrument which obtains the waveform number parametrically. The “Test ID” indicated under each graph identifies both the waveform number in WaveformOrch.xml and the corresponding test tone number. For instructions, see Viewing the Waveform Orchestra.

The waveforms described on this page have been created with a consistent length of 512 samples. As explained in the discussion of foldover, the highest harmonic representable by a waveform of length 512 is the 256th harmonic, since at least one sample is required for the up phase, and at least one other sample is required for the down phase. Since the waveforms actually illustrated on this page extend no higher than the 16th harmonic, this in fact allocates 512/16 = 32 samples for up and down phases combined. Which is good.

At the audio CD-standard sampling rate of 44100 samples per second, the highest frequency which may be generated is 22050 Hz. Having a waveform with 16 harmonics additionally limits this ceiling to 22050/16 =1378 Hz., which rounds down to E6 (the E two octaves and a third above middle C). For pitches in the range from F6 to E7, waveforms should be limited to 8 harmonics. Four harmonics is the limit between F7 and E8. Two harmonics is the limit between F8 and E9. C10, at 16744 Hz., is outside the range of most human hearing.

Sine Wave

The sine wave represents the purest tone. It has exactly one harmonic, which is the fundamental.


Figure 1: Sine wave. Test ID: 1. To hear a realization, click here.

Sawtooth Wave

In the sawtooth family of waveforms, the amplitude of each harmonic descends as the inverse of the harmonic number.

Harmonic12345678910111213141516
Amplitude1.0000.5000.3330.2500.2000.1670.1430.1250.1110.1000.0910.0830.0770.0710.0670.063

Figure 2-1: Sawtooth wave with 2 harmonics (one octave). Test ID: 202. To hear a realization, click here.

Figure 2-2: Sawtooth wave with 4 harmonics (two octaves). Test ID: 204. To hear a realization, click here.

Figure 2-3: Sawtooth wave with 8 harmonics (three octaves). Test ID: 208. To hear a realization, click here.

Figure 2-4: Sawtooth wave with 16 harmonics (four octaves). Test ID: 216. To hear a realization, click here.

Rounded-Sawtooth Wave

In the rounded-sawtooth family of waveforms, the amplitude of each harmonic descends as the squared inverse of the harmonic number. The rounded-sawtooth wave is to the sawtooth wave as the triangle wave is to the square wave.

Harmonic12345678910111213141516
Amplitude1.0000.2500.1110.0630.0400.0280.0200.0160.0120.0100.0080.0070.0060.0050.0040.004

Figure 4-1: Rounded-sawtooth wave with 2 harmonics (one octave). Test ID: 302. To hear a realization, click here.

Figure 4-2: Rounded-sawtooth wave with 4 harmonics (two octaves). Test ID: 304. To hear a realization, click here.

Figure 4-3: Rounded-sawtooth wave with 8 harmonics (three octaves). Test ID: 308. To hear a realization, click here.

Figure 4-4: Rounded-sawtooth wave with 16 harmonics (four octaves). Test ID: 316. To hear a realization, click here.

Square Wave

In the square family of waveforms, only the odd harmonic numbers are present. The amplitude of each harmonic descends as the inverse of the harmonic number.

Harmonic13579111315
Amplitude1.0000.3330.2000.1430.1110.0910.0770.067

Figure 3-1: Square wave with harmonics 1 and 3 (2 octaves). Test ID: 403. To hear a realization, click here.

Figure 3-2: Square wave with harmonics 1, 3, 5, and 7 (3 octaves). Test ID: 407. To hear a realization, click here.

Figure 3-3: Square wave with harmonics 1, 3, 5, 7, 9, and 11 (3 ½ octaves). Test ID: 411. To hear a realization, click here.

Figure 3-4: Square wave with harmonics 1, 3, 5, 7, 9, 11, 13, and 15 (4 octaves). Test ID: 415. To hear a realization, click here.

Triangle Wave

In the triangle family of waveforms, only the odd harmonic numbers are present. The amplitude of each harmonic descends as the squared inverse of the harmonic number. Also, harmonics 3, 7, 11, 15, etc. are phase shifed by 180°.

Harmonic13579111315
Amplitude1.0000.1110.0400.0200.0120.0080.0060.004
Phase0.00.50.00.50.00.50.00.5

Figure 5-1: Triangle wave with harmonics 1 and 3 (2 octaves). Test ID: 503. To hear a realization, click here.

Figure 5-2: Triangle wave with harmonics 1, 3, 5, and 7 (3 octaves). Test ID: 507. To hear a realization, click here.

Figure 5-3: Triangle wave with harmonics 1, 3, 5, 7, 9, and 11 (3 ½ octaves). Test ID: 511. To hear a realization, click here.

Figure 5-4: Triangle wave with harmonics 1, 3, 5, 7, 9, 11, 13, and 15 (4 octaves). Test ID: 515. To hear a realization, click here.

Here is what a triangle wave looks like when you set all phases to 0°. Theory says that phase makes no difference. You can confirm or deny that theory by comparing test tone #515 with test tone #615 in WaveformOrch.xml.


Figure 6: Waveform with harmonics 1, 3, 5, 7, 9, 11, 13, and 15 (4 octaves), inverse squared amplitudes, but all 0° phase values. Test ID: 615. To hear a realization, click here.

Pulse Wave

In the pulse family of waveforms, all harmonics have equal amplitude. The result is a buzzing sound not unlike the human glottis, which makes pulse waves essential for speech synthesis.

Harmonic12345678910111213141516
Amplitude1.0001.0001.0001.0001.0001.0001.0001.0001.0000.1001.0001.0001.0001.0001.0001.000

Figure 7-1: Pulse wave with 2 harmonics (one octave). Test ID: 702. To hear a realization, click here.

Figure 7-2: Pulse wave with 4 harmonics (two octaves). Test ID: 704. To hear a realization, click here.

Figure 7-3: Pulse wave with 8 harmonics (three octaves). Test ID: 708. To hear a realization, click here.

Figure 7-4: Pulse wave with 16 harmonics (four octaves). Test ID: 716. To hear a realization, click here.

Rectange Wave

Rectangle waves generalize square waves by making portion of the waveform spent in the ‘up’ phase controllable. The control parameter is known as the duty cycle. So for example a rectangle wave with a 50% duty cycle is a square wave. A rectangle with a 25% duty cycle spends 1/4 of its wave cycle in the up position and 3/4 of its wave cycle in the down position. A 25% rectangle wave sounds exactly like a 75% rectangle wave. The limiting case of a rectangle wave as the duty cycle approaches zero is a pulse wave; however when the duty cycle actually reaches 0%, silence results.


Figure 8: Rectangle-wave generator.

The Wikipedia article on pulse waves actually concerns itself with the waveforms described here as rectangle waves. This article gives the following instructions for calculating rectangular waveforms:

A [rectangle] wave can be created by subtracting a sawtooth wave from a phase-shifted version of itself. If the sawtooth waves are bandlimited, the resulting [rectangle] wave is bandlimited, too. Another way to create one is with a single ramp wave (sawtooth or triangle) and a comparator, with the ramp wave on one input, and a [constant] threshold on the other. The result will be a precisely controlled pulse width, but it will not be bandlimited.

The Sound waveform manager requires waveforms to be described by adding together just one harmonic for each harmonic number — you can't specify two phase-shifted instances of the same harmonic. There is undoubtedly a formula giving the harmonic intensities for a rectangle waveform with whatever duty factor, but I don't know it. However, it is simple enough to implement Wikipedia's instructions within an audio processing instrument using the configuration shown in Figure 8. The essential units are an oscillator generating a sawtooth wave, a delay line to phase-shift the oscillator output, and a subtract operator. And this implementation has the advantage that swapping control signals for P8, P10, and V1 gives you dynamic timbre modulation.


Figure 9-1: Rectangle wave with 16 harmonics and 10% duty factor. To hear a realization, click here.
  
Figure 9-2: Rectangle wave with 16 harmonics and 20% duty factor. To hear a realization, click here.
  
Figure 9-2: Rectangle wave with 16 harmonics and 30% duty factor. To hear a realization, click here.
  
Figure 9-2: Rectangle wave with 16 harmonics and 40% duty factor. To hear a realization, click here.
  
Figure 9-2: Rectangle wave with 16 harmonics and 50% duty factor. To hear a realization, click here.

Here is a tip about generating rectangle waves which I found on AllAboutCircuits.com and pass along unverified:

If n is the notional harmonic and D is the duty then if nxD is an integer the nth harmonic value is zero.

If D=0.25 then the 4th, 8th, 12th, etc... harmonics are zero.

If D=0.1 then the 10th, 20th, 30th etc are zero.

and so on.....

Low-Frequency Waves

In the classic waveforms presented up to this point, the harmonic with the greatest amplitude has generally been the fundamental. However with many low-frequency tones it is often desirable to shift the energy upwards in the frequency spectrum.

I have looked around for a mathematical formula that will do this, and the most suitable formula I have discovered is a discrete probably distribution — specifically the Negative Binomial distribution. Disregarding the distribution's original purpose1, I have manipulated N and p to obtain instances which peak at specific harmonics while rolling off to around 0.001 at harmonic #16. The following table details N and p values for harmonics 1 (the fundamental) through 6.

PeakOctaveNp12345678910111213141516
1unison10.3751.0000.6250.3910.2440.1530.0950.0600.0370.0230.0150.0090.0060.0040.0020.0010.001
2120.4690.9411.0000.7970.5640.3750.2390.1480.0900.0540.0320.0190.0110.0060.0040.0020.001
31 ½40.5940.6060.9851.0000.8120.5780.3750.2290.1330.0740.0400.0210.0110.0060.0030.0010.001
4280.6880.2730.6830.9601.0000.8590.6450.4360.2730.1600.0890.0470.0240.0120.0060.0030.001
52 ¼90.6660.1620.4880.8150.9981.0000.8680.6770.4840.3240.2040.1230.0710.0390.0210.0110.006
62 ½190.7820.0600.2500.5450.8320.9971.0000.8720.6790.4810.3150.1920.1100.0600.0310.0160.007

Figure 10-1: Waveform peaking on fundamental (unison). Generated using Negative Binomial formula with N=1 and p=0.375. Test ID: 801. To hear a realization, click here.

Figure 10-2: Waveform peaking on 2nd harmonic (1 octave). Generated using Negative Binomial formula with N=2 and p=0.469 Test ID: 802. To hear a realization, click here.

Figure 10-3: Waveform peaking on 3rd harmonic (1 ½ octaves). Generated using Negative Binomial formula with N=4 and p=0.594. Test ID: 803. To hear a realization, click here.

Figure 10-4: Waveform peaking on 4th harmonic (2 octaves). Generated using Negative Binomial formula with N=8 and p=0.688. Test ID: 804. To hear a realization, click here.

Figure 10-5: Waveform peaking on 5th harmonic (2 ¼ octaves). Generated using Negative Binomial formula with N=9 and p=0.666. Test ID: 805. To hear a realization, click here.

Figure 10-6: Waveform peaking on 6th harmonic (2 ½ octaves). Generated using Negative Binomial formula with N=19 and p=0.782. Test ID: 806. To hear a realization, click here.

Variations: Omit the even-numbered harmonics, multiples of 3, etc.

Octave-Doubled Sine Wave

In the octave-doubled sine family of waveforms, the only harmonic numbers present are powers of two; that is, octave doublings of the fundamental. The amplitudes all harmonics are the same.

To some this family of waveforms may seem trivial. I myself hadn't thought to include it when this page was originally posted. However I found it useful as a cheap way of extending one-octave sine clusters into multi-octave frequency ranges. In the process I rediscovered what many organ performers already know — that doubling a tone at the octave greatly increases its penetrating power.

Harmonic124816
Amplitude1.0001.0001.0001.0001.000

Figure 11-1: Octave-doubled sine wave with harmonics 1 and 2 (1 octave). Test ID: 902. To hear a realization, click here.

Figure 11-2: Octave-doubled sine wave with harmonics 1, 2, and 4 (2 octaves). Test ID: 904. To hear a realization, click here.

Figure 11-3: Octave-doubled sine wave with harmonics 1, 2, 4, and 8 (3 octaves). Test ID: 908 To hear a realization, click here.

Figure 11-4: Octave-doubled sine wave with harmonics 1, 2, 4, 8, and 16 (4 octaves). Test ID: 916. To hear a realization, click here.

Comments

  1. For the record, this distribution predicts the number beyond N of random trials necessary to produce N successes if each trial has probability p of succeeding.

© Charles Ames Page created: 2013-02-20 Last updated: 2017-06-24