There is a quiet soundscape that plays on the clock we put on the wall during SSM exams. People assume it is a recording. It is not: there is no audio file anywhere. Every sample is computed, live, from four systems you have already met in this course — a comb filter, a pair of sinusoids, a set of envelopes, and one convolution.

That is the point of this page. The synthesizer is a toy; what is not a toy is that a plucked string, a beating drone, a chord and a concert hall are all objects we can write down as systems, and that writing them down is enough to hear them.

1.  The string: a delay line that loses a little each turn

Take L samples of memory, feed the output back to the input, and lose a little on the way round. That is the whole instrument:

y[n] = g (y[n-L] + y[n-L-1]) / 2

Start it with noise (that is the pluck: noise excites every mode at once) and it rings. With the loop filter F(z) = ½(1 + z−1), the transfer function is

H(z) = 1 / (1 - g F(z) z^-L)

The denominator vanishes whenever the round trip returns in phase and at full size, so the poles sit close to the harmonics of fs/L: the delay line sets the pitch. The interesting part is the radius of those poles. On the unit circle, z = e,

|g F(e^jw)| = g |cos(w/2)|

which is close to g at low frequency and goes to zero at Nyquist. Each turn round the loop the high modes are attenuated much more than the low ones, so the pole radius and the decay time of mode n are

r_n = (g|cos(w_n/2)|)^(1/L),  tau_n = -(L/fs)/ln(g|cos(w_n/2)|)

The bright, noisy attack lasts a few tens of milliseconds and what survives is a nearly pure fundamental. That decay-rate-per-mode is the whole timbre of a plucked string, and it is the same story told in the guitar synthesizer curiosity, only there we built it from a sum of second-order modes and here from a single loop.

Stability, audibly. Set g > 1 and the poles walk outside the unit circle: the note does not decay, it grows, and in a second or two it is clipping. A student who has never believed that |p| < 1 matters can be made to believe it in one line of code.

2.  The drone: two sinusoids and a beat

Two sinusoids a hair apart, summed:

sin(2 pi f1 t) + sin(2 pi f2 t) = 2 cos(2 pi (f1-f2)/2 t) sin(2 pi (f1+f2)/2 t)

A tone at the mean frequency, with an envelope at half the difference — so the loudness swells |f1−f2| times per second. With f1 = 110 Hz and f2 = 1.003 f1, that is one swell every three seconds. It is amplitude modulation that nobody asked for, and it is exactly what makes a held note sound alive instead of like a test tone. Piano tuners use it backwards: they detune until the beats stop.

3.  The chords: a scale where nothing can go wrong

The notes are drawn at random from the minor pentatonic, {0, 3, 5, 7, 10} semitones. That scale has no minor seconds and no tritone, so any two of its notes are consonant: a random draw can never produce a wrong chord. Each note gets an envelope with attack, sustain and decay of several seconds — slow enough that no two notes ever start together and the ear hears a texture rather than a rhythm.

Why no rhythm, on purpose. In the exam version the notes are spaced by irregular intervals of 5 to 12 seconds. A regular pulse would give the room a metronome, and a metronome is the last thing anyone wants while sitting an exam.

4.  The room: one convolution

A room is a linear time-invariant system. Clap once and what you hear is its impulse response h[n]; play anything else and what you hear is

y[n] = (x * h)[n] = sum_k x[k] h[n-k]

We do not have a room, so we invent a plausible impulse response: white noise with an exponential decay, three or four seconds long. Dense early reflections, decaying tail, no structure — which is what a real hall's impulse response looks like once you stop looking at the first few milliseconds. Convolve, mix half of it back in, and the same dry notes are suddenly in a hall. This is the cheapest possible demonstration that convolution is not an exercise: it is the operation that puts a sound in a place.

5.  All of it, in MATLAB

Ninety seconds of it, from the four ideas above. It needs no toolbox, and the four numbers at the top change its character completely. Full script attached: ambiente.m

%% the string: a delay line with a lossy two-tap average in the loop
function s = corda(f, dur, damp, fs)
    L = max(2, round(fs/f));
    anel = 2*rand(L,1) - 1;              % the pluck: all modes at once
    s = zeros(round(fs*dur),1);  k = 1;
    for i = 1:numel(s)
        s(i) = anel(k);
        k2 = mod(k, L) + 1;
        anel(k) = damp * 0.5 * (anel(k) + anel(k2));
        k = k2;
    end
end

%% the drone: two sinusoids 0.3% apart, so they beat every three seconds
t = (0:round(fs*T)-1)'/fs;
bordao = 0.11*sin(2*pi*f0*t) + 0.11*sin(2*pi*f0*1.003*t);

%% the room: convolution with decaying noise
h   = (2*rand(round(fs*3.6),2)-1) .* (linspace(1,0,round(fs*3.6))'.^2.4);
wet = [conv(y(:,1), h(:,1), 'same')  conv(y(:,2), h(:,2), 'same')];
y   = 0.75*y + 0.55*wet/max(abs(wet(:)));

soundsc(y, fs)

Where this meets the syllabus

  • Transfer functions and feedback — the string is H(z) = 1/(1 − g F(z) z−L).
  • Poles and stability — g < 1 rings and dies, g > 1 blows up. You can hear the unit circle.
  • Frequency-dependent damping — the loop filter makes |pn| decrease with n, so high modes decay first. That is the timbre.
  • Comb filters — a delay of L samples in a loop puts peaks every fs/L Hz.
  • LTI systems and convolution — reverberation is literally x ∗ h.
  • Modulation and beating — sum-to-product turns two tones into one tone with an envelope.
  • Fourier series — the band-limited sawtooth is the series truncated at five terms.

An exam question hiding in here

A Karplus–Strong string uses L = 400, g = 0.998, fs = 44.1 kHz, and the loop filter F(z) = ½(1 + z−1).

  1. Write H(z) and give the fundamental frequency.
  2. Show that the loop-gain magnitude at normalised frequency ω is g |cos(ω/2)|.
  3. Compute the time for the fundamental to fall 60 dB, and the same for the 10th harmonic. Comment on the ratio.
  4. What is heard if g = 1.001? Justify with the pole radii.

References & credits

  1. K. Karplus and A. Strong, “Digital Synthesis of Plucked-String and Drum Timbres,” Computer Music Journal, vol. 7, no. 2, pp. 43–55, 1983.
  2. D. A. Jaffe and J. O. Smith, “Extensions of the Karplus–Strong Plucked-String Algorithm,” Computer Music Journal, vol. 7, no. 2, pp. 56–69, 1983.
  3. J. O. Smith, Physical Audio Signal Processing, online book, ccrma.stanford.edu/~jos/pasp/.
  4. Companion page in these curiosities: My First Guitar Synthesizer, where the same string is built from a sum of second-order modes instead of a single loop.

The soundscape plays on the SSM exam clock. It is generated in the listener's own browser: there is no audio file, nothing is downloaded, and the machine serving the page does no work for it.

Carlos Cardeira, Instituto Superior Técnico, 2026. Written for Sinais e Sistemas Mecatrónicos.