My son's clarinet doesn't have an octave key. Instead, there's a key which, combined with overblowing, makes notes go up by a twelfth. What up with that? And why do intervals have the ratios they do, anyway? How are we supposed to tune? To answer these questions, we need to do a bit of math.
First, intervals. A string tied at both ends can support a standing wave of wavelength 2L (if L is the length of the string). That's the fundamental. Lightly touch the string in the middle to put a node there, and you get a harmonic, a wave of length L, double the frequency of the fundamental, or an octave. This has two half-waves in the string, but we can put any integer number: 3 (which makes twelfth from the fundamental), 4 (the second octave), 5 (two octaves and a third), and so on. All the intervals are connected by integer ratios, which are also all present as part of the tone of the note from the plucked string. Fine, so intervals are connected with the harmonics of a 1D vibration.
But why? seems like a natural question at this point. To me, there are lots of other examples of vibrating structures, not all of which have the frequencies of their harmonics related as integers. Why does our brain put particular emphasis on the 1D string? Well, I'd guess it has to do with our vocal cords being 1D strings. There's brain circuitry devoted to identifying intervals like octaves and fifths, which has been demonstrated in a variety of creatures, eg owls. Or so my wife tells me, she read a book on it once.
Now, tuning and the chromatic scale: if you go up by fifths, wrapping down by dropping the pitch an octave, you get the sequence C, G, D, A, E, B, F#. The closest note to your starting note is B, which has a pitch ratio of (3/2)^5/2^3 = 0.9492, which is lower than the C by about 5%. This is the ratio of a major 7th to an octave. Arranged in order of pitch, they form a sequence of pitches with small gaps, which we can identify as the western scale. (Well, since we started with C, it's the scale in the Lydian mode.) If you choose fewer than 7, you get a scale with wider leaps, eg the first five give the pentatonic scale, C D E G A. Pentatonic is supposedly another universal, occurring in all peoples and cultures.
If you keep going, you fill in the gaps, until you get to twelve notes. At that point, you've reached a note I'll call C', which is (3/2)^12/2^7 = 1.0136, about 1% higher than our starting pitch. Now the arguments begin. In the true tempered scale, which is how most of our pianos are tuned, we force these to be equal. So replace every interval with the appropriate number of half-steps, and define a half-step to be the twelfth root of 2 = 1.0595. That's a full 10% different from the B-C interval we calculated from integer ratios, a difference easily heard, particularly if played directly against the other pitch, so that there are beats from interference. You can't even get away with the true tempered intervals by playing only with other precisely tuned true tempered instruments, since the harmonics of the notes themselves will follow the integer ratios, if the pitches are formed by anything vibrating like a 1D string, and you'll get beating among the harmonics of the notes. But nor can you use only integer (perfect interval) pitch ratios, since then the note you're playing will depend on the path you took to get there. C vs C' is only one example, it'll occur everywhere.
Fine. So what about the clarinet? Why doesn't it have octaves? More later.