Sound from a microphone on HDA Intel in Ubuntu

There's enough voodoo in this that it needs documenting somewhere. This is how to get a microphone working in Ubuntu Edgy (at least), with a HDA Intel on-board sound card.

First, the microphone is plugged into the rear input mic socket. Then make sure everything is configured to use ALSA, not OSS. I have ESD disabled too. Next, open Volume Control (gnome-volume-control). File > Change Device to the ALSA device (HDA Intel), then in the preferences make sure all tracks are visible.

In the Options tab, set the second input source (which corresponds to Capture) to Mic, and the first input source (which corresponds to Capture 1) to something else.

In the Capture tab, make sure Capture is enabled and unmuted, with the volume on full. Also make sure Capture 1 is disabled.

That should be enough: if you open Sound Recorder you should be able to record sound from your microphone, using Capture as an input source, and should be able to talk in Skype as well.