A hollow, buzzy tone, like a clarinet or an old video game, from a wave that jumps between high and low; its pulse width makes it thinner and more nasal.

In the menu: sources, then oscillators.
Each setting has a knob, which disappears when something is connected to its input.
The square oscillator makes a wave that sits at its top for a while, jumps to its bottom, sits there, and jumps back up, over and over. Where a sine wave is smooth and pure, the sudden jumps give the square wave a hollow, reedy buzz: the sound of a clarinet's low notes, of a cheap electronic buzzer, and of the music in 1980s video games.


Its spectrum shows why it sounds hollow: alongside the note itself, it has harmonics at 3, 5, 7, 9 and every odd number of times the note's frequency, but none at the even numbers. Each odd harmonic is a sine wave, and added together they build the square's flat tops and steep sides:

The pulse width changes how long the wave spends at the top of each cycle. Make it smaller than 0.5 and the wave becomes a train of narrow pulses, and the sound gets thinner, brighter and more nasal: the "pinched" tones of old computer sound chips. At 0.25 the top lasts a quarter of each cycle:


and at 0.1, a tenth:


A pulse width of 0.75 sounds exactly the same as 0.25 (it's the same wave upside down), and 0.9 the same as 0.1. Right at 0 or 1, the wave never jumps at all, and you hear nothing.
The pulse width really comes alive when something moves it. Connect a slow lfo, and as the width sweeps back and forth the sound shimmers and swirls, as if several instruments were playing slightly out of tune. This is pulse width modulation, PWM, and it's the sound of countless synthesizer strings and pads. In this synth, a sine lfo sweeps the width between 0.1 and 0.9 every three seconds or so; watch the gaps in the spectrum sweep back and forth:

Here's a square wave set up to play notes, as a synth's voice: a note input sets its frequency, an adsr times its velocity sets its amplitude, and a factor input called width sets its pulse width, so each note can have its own:

A 50% square has only the odd harmonics, each at a level of 1/k of the fundamental (falling at 6 dB per octave, like a sawtooth's, but with the even ones missing). The missing even harmonics, especially the absent octave, give the hollow, "closed pipe" quality shared with the clarinet's chalumeau register (where the cylindrical bore suppresses the even harmonics) and with stopped organ pipes. Filtered gently, a square is a convincing clarinet; filtered hard, a soft, round bass; left open, a bright, almost harsh buzz.
A pulse of width w has harmonic k at a level proportional to |sin(πkw)|/k, so it loses every harmonic whose number is a multiple of 1/w: w = 1/2 loses the even ones, 1/3 every third (a slightly nasal tone), 1/4 every fourth, and so on. As w shrinks, the harmonics up to about the 1/w-th become nearly equal in level, so the spectrum looks like a flat comb, cut off and rolling off above 1/w times the note: the thin, bright, nasal "pinch" of narrow pulses. The fundamental gets quieter as the width narrows (at w = 0.1 it's at 0.31 of a square's), so narrow pulses also sound quieter, and an envelope or modulation on the width changes the loudness as well as the tone.
The NES's two pulse channels offered widths of 12.5%, 25% and 50%, which is a good palette for chiptune: 50% for round leads, 25% for brighter ones, 12.5% for thin, nasal ones.
Modulating the width moves the nulls of that comb up and down the harmonic series, which the ear hears as the moving notches of a phaser or the beating of a chorus. In fact a pulse wave is exactly two sawtooth waves of opposite polarity, w of a cycle apart (that's how this oscillator makes it: see below), so moving w is like moving one sawtooth's phase against the other's, which is what two detuned oscillators do. A sine or triangle lfo between about 0.1 and 0.9 at 0.2 to 2 Hz is the classic string-machine sound; an envelope on the width gives each note a sweep. Keep the width away from 0 and 1, where the note thins out to nothing.
The waveform spends w of its time at +A and 1 − w at −A, so its average isn't 0 but (2w − 1)A: −0.8 times the amplitude at a width of 0.1. You won't hear this offset, but it's there in the waveform, and an envelope on the amplitude makes it move with every note. If it matters, for instance before a distortion node, which is sensitive to where the wave is centred, a high pass filter set to a few hertz takes it out.
The oscillator keeps a phase φ, as all the oscillators do (see the sine oscillator), and computes the pulse as the difference of two band-limited sawtooths, one delayed by the width w, plus a constant:

since saw(φ) = 2φ − 1 jumps down by 2 at φ = 0 and the delayed one at φ = w, their difference is a pulse that's 2 − 2w high for the first w of the cycle and −2w for the rest, which the constant moves to +1 and −1. Each sawtooth is read from the same band-limited table the sawtooth oscillator uses (see the sawtooth oscillator for how), so the pulse is band-limited too, and since w only sets where the second one is read, the width can change at any speed, even at audio rates, without clicks or aliasing.
The Fourier series above gives the harmonic amplitudes, (4/πk)|sin πkw|, and shows the zeros at kw ∈ ℤ, and the symmetry w ↔ 1 − w (the same magnitudes; the wave is inverted and shifted). Its mean is the k = 0 term, 2w − 1.
The scope shows a small overshoot and ripple at each edge. That's the Gibbs phenomenon: a sum of a finite number of harmonics approaches a jump with an overshoot of about 9% of the jump's height, however many harmonics it has. It's the unavoidable price of keeping every harmonic below half the sample rate, and it's not audible as such; it's what an ideal square wave sounds like after the anti-aliasing filter of any digital system.
Back to Sources: oscillators