Measuring the mains requires an isolating transformer for safety's sake, like this:
The transformer is from an old piece of equipment (a dead CD player) with a 10:1 attenuator placed across a 3.6VAC secondary winding. The attenuator ensures the transformer is not loaded down, and that the output will not 'clip' at the soundcard ADC. Mac shareware - Digital Oscilloscope 2.1 (H.R.Baer) and Spectrum Analyser 1.1.2 (Daffy Software) - produced the visuals.
This arrangement is not the last word in precision; the transformer, not being designed for AF use, limits the frequency response measurable - it acts as a low pass filter; it probably also contributes some 2nd harmonic distortion (hysteresis; much smaller in magnitude than the mess coming in from the local substation). It doesn't matter much, we're only interested in qualitative issues and the soundcard is pretty limited compared with proper instrumentation...
© the twisted pair 2002