# Square wave

## Overview

**Audio: square wave (0:02)**

**square wave** plays a square wave. The *square wave* figure shows a close up of its waveform which is shaped like a square.

A square wave consists of a harmonic series of odd-numbered partials. The amplitude of each partial is inversely proportional to its number.

A square wave is a special case of a pulse wave with a duty cycle of 50%.

A square wave consists of the odd-numbered partials 1 (the fundamental) 3 5 7 9 11 and so on. The fundamental in *square wave* has a frequency of 100Hz, the second partial has a frequency of 300Hz and its amplitude is one third of the fundamental, the third partial has a frequency of 500Hz and its amplitude is one fifth of the fundamental and so on.

A square wave synth is used to write melody and harmony and has a hollow sound something like that of a wind instrument. A square wave is also a good source for producing percussive sound effects.

Aliasing is a problem that might occur whenever you generate a sound such as a square wave. It is a type of distortion and is thus to be avoided. It only occurs in digital audio not in analogue recording.

Aliasing occurs when the frequency of a sound exceeds a limit known as the Nyquist frequency. The Nyquist frequency is half the sampling rate. At a sampling rate of 44,100Hz the Nyquist frequency is 22,050Hz. A square wave whose fundamental is 1000Hz will produce a 23rd partial with a frequency of 23,000Hz. This partial is higher than the Nyquist frequency and aliasing will occur. Some computer programmes and apps have a built in safety feature to prevent such aliasing and whenever you see the phrases, anti-aliasing or band-limited, this indicates that a sound will not distort. The only other alternative is to work out the Nyquist frequency by hand and make sure the partials do not exceed this frequency.