Blow Into a Tube
A clarinet with no oscillator in it. A tube and a flap of cane, and the note is what the loop between them settles on.
What it is
Hold anywhere on the pad and blow. Across is pitch, which is really the length of the tube. Up is how hard you blow. The green band is where it will actually make a sound, and you can see it before you get there.
Space, or the button, opens the register key. Softer and harder reeds move the band.
I played clarinet as a kid, so the thing I wanted to check was whether the low register came out right. Long tube, register closed, gentle breath. It does, and that surprised me more than the rest of it.
How it works
There’s no oscillator in this. Nothing in the code generates a waveform.
A cylindrical bore is a delay line. Sound goes down it, reflects off the open end, comes back. The reed is a valve that closes as the pressure across it rises. Neither part oscillates on its own. Couple them together and the loop finds a note.
Two things fall out of the geometry rather than being programmed in.
The open end reflects pressure with its sign flipped, so a round trip inverts. That makes the bore a quarter-wave resonator: it sounds at c/4L, not c/2L, and it only supports odd multiples of that. Measured against the arithmetic:
| bore | c/4L | measured |
|---|---|---|
| 0.35 m | 245.0 Hz | 243.6 Hz |
| 0.50 m | 171.5 Hz | 170.3 Hz |
| 0.60 m | 142.9 Hz | 142.7 Hz |
| 1.20 m | 71.5 Hz | 71.2 Hz |
The error shrinks with length, from 0.55% down to 0.16%, and it’s the same problem day 28 had: the delay line is a whole number of samples, so short tubes round harder. Nothing about the reed is involved.
And because the second resonance is three times the first rather than twice, opening a vent a third of the way along forces a pressure node there. The fundamental has no node at that point so it can’t survive, the third mode does, and the tube is acoustically terminated early. That’s why a clarinet overblows a twelfth and not an octave, and it’s why the fingerings go strange above the break.
| bore | closed | register open | ratio |
|---|---|---|---|
| 0.50 m | 170.3 Hz | 506.9 Hz | 2.977 |
| 0.60 m | 142.7 Hz | 428.2 Hz | 3.000 |
| 0.80 m | 106.8 Hz | 317.3 Hz | 2.971 |
The odd-harmonic claim measures out harder than I expected. At a 60 cm bore, blowing 0.6:
| harmonic | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
|---|---|---|---|---|---|---|---|
| amplitude | 0.670 | 0.002 | 0.049 | 0.001 | 0.033 | 0.0004 | 0.003 |
Odd against even, by energy: 70,000 to one. That’s the clarinet’s whole character and nobody put it in. It’s the sign of a reflection.
The instrument runs in an AudioWorklet, on the audio thread, importing the same
reed.ts the tests measure. One difference: solving the reed-and-bore junction exactly
costs about a hundred square roots per sample, which is fine in a test and hopeless at
44,100 samples a second, so real time reads a precomputed table instead. There’s a test
that the table agrees with the exact solve.
What surprised me
It won’t play at all until you reach a specific pressure, and that pressure is derivable.
The reed is where energy comes from, and the mechanism is a fight between two effects. Bernoulli says air flow grows as the square root of the pressure across the reed. The reed says the gap narrows as that pressure rises, and shuts completely at some value. Multiply the two and you get a curve that rises, peaks, and comes back to zero.
The falling half is the instrument. A region where pushing harder moves less air is a negative resistance, and a negative resistance inside a resonant loop oscillates.
So I measured where it starts sounding, for five different reed stiffnesses:
| reed shuts at | starts sounding at | ratio |
|---|---|---|
| 0.50 | 0.171 | 0.342 |
| 0.75 | 0.254 | 0.339 |
| 1.00 | 0.337 | 0.337 |
| 1.50 | 0.500 | 0.333 |
| 2.00 | 0.662 | 0.331 |
Converging on exactly a third. And a third is precisely where the flow curve turns over, because for this reed shape the peak sits at closing/3.
The threshold isn’t a constant I tuned. It’s the location of a maximum. Below the peak the reed is a positive resistance and damps the tube; above it the sign flips and the tube gets driven. You can watch that on the flow curve while you play: the shaded half is the half that works.
The other edge is real too. Blow past the closing pressure and it stops dead, because
the pressure difference holds the reed against the mouthpiece. Measured, that edge lands
at exactly the closing pressure, so the playable range is always
closing/3 to closing. A factor of three, whatever reed you fit.
That’s a satisfying explanation for something I never understood as a child. A harder reed doesn’t just mean blowing harder, it means the whole window slides up and gets proportionally wider. And a reed too soft for you chokes at a pressure you’d blow without noticing.
Two failures on the way, both worth writing down.
The first model didn’t oscillate at all. I started with the classic digital shortcut, a reed reflection coefficient that’s a straight line in pressure with a clip on it. I swept a 7 by 7 grid of its two parameters and exactly one cell made a sound. Everything else settled to a DC value precisely equal to the blowing pressure.
That’s the correct behaviour for what I’d built. A clipped straight line saturates into a passive reflector with a gain of one, the bore loses 3% a round trip, so the loop decays. No amount of tuning fixes it, because there’s no negative resistance anywhere in a straight line. I had to put the actual pressure-flow curve in, with its maximum, before anything played.
And my threshold finder reported Infinity. I’d written it as a bisection from below, which assumes that if it sounds at some pressure it sounds at every pressure above. It doesn’t. It chokes. The function tested the top of the range, found silence, and concluded the instrument never plays at all.
The sounding region is a band with two edges, so it needs bracketing from the inside out: find any pressure that works, then walk outward to each edge. I only caught it because the answer was Infinity rather than plausible.
What I would do next
A conical bore, which supports all the harmonics and overblows an octave. Same delay line, same reed, one changed reflection, and it should stop sounding like a clarinet and start sounding like a saxophone. That would be the cleanest possible demonstration that the timbre is in the shape of the tube and nothing else.