I see that others have posted replies while I was away from my computer (Christmas festivities, you know). Since I'd already typed much of the answers below, I'll post them anyway.
Many thanks to both of you. Pjdd's circuit in particular is really helpful. Is there somewhere I can find more information on this technique?
I just made up this exact design after reading your post without referring to any other source, but the principle of using diodes to clamp a signal is well known. So you should be able to find useful references if you search with a parameter like "diode clamp".
In particular I'm wondering about the purpose of having several diodes in serial. (Does it reduce the distortion when the signal isn't clipping, or provide extra protection, or both?)
The diodes are there to protect the input of your sound card. They do not prevent distortion. In fact, they cause distortion when the input signal is above a certain threshold.
We're making use of a silicon diode's non-linear characteristics here. A diode passes very little current even in the forward direction until a certain breakover voltage is reached. Therefore, at input voltages of up to a few hundred millivolts peak, it's as if the diodes are not there at all. That is, the diodes act approximately like an open circuit.
When the input signal reaches an amplitude high enough to make the diodes conduct, their AC impedance decreases quickly so that a part of the signal is dropped in the 10k series resistors. Even if we keep increasing the signal voltage, the diodes' dynamic impedance decreases further so that the voltage across the diodes rises only by a small amount. In other words, the input voltage to the sound card is clamped.
The clamped voltage is around 0.5-0.6V per diode depending on the amplitude of the external input signal. Three diodes in series limit the output to the sound card at about 1.5-1.8V peak. Two sets of 3 diodes each are paired in opposite polarity for each channel so that the incoming signal is clamped for both positive and negative swings.
I'm also wondering whether I could safely replace the 10k resistors with potentiometers in order to create a gain control - I guess I'm sometimes going to want to record quite low voltage signals and sometimes quite high ones, depending on the circuit I'm playing with, so building this into a little box with a volume knob would be a really handy little project.
It will be better if you leave the 10k resistors as they are and place a potentiometer configured as a volume control in front of them, that is, where the external signal comes in.