Audio Spectrum Analyzer
Con, ZL2AFP, Version of March 2011
Help File Version of 4 September 2011: Gary ZL1AN
Introduction:
Spectrum analyzer averages many samples of the power spectrum of an audio waveform applied to the soundcard. It can be used to capture the shape of the audio passband of a receiver tuned to a vacant portion of the spectrum, receiving only random noise.
The captured spectral data can be copied to a text file or the clipboard.
Setting up the soundcard:
- Start Spectrum Analyser. Select "soundcard/mixer" from the top toolbar. The "volume control" panel will show. Tick the boxes which mute "microphone" and the "line in".
- Select "Options" from the "volume control" panel, then "Properties,", then "Recording control". Tick the box which selects "Line in". Close the sound-card panel.
Capturing a Receiver's Passband shape:
- Tune the receiver to a vacant portion of the spectrum, where only noise is audible.
- Press the "start" button on the Spectrum Analyser panel. Connect audio from the phone jack of the receiver - or some other supplied output - to the line input of the soundcard. A rapidly-varying spectrum should now show in the window.
- Adjust the audio volume using the receiver volume control and/or the soundcard recording control (see above for selecting this) until the plot shows the spectrum shape clearly above the noise floor, but without overloading (the noise floor will rise). The spectrum can be moved vertically with the "Y-offset" slider. The audio output volume from the program can be varied by selecting "Soundcard/Audio devices" from the top panel, and also adjusted with your sound-card's volume control.
- The program starts with the "FFT average" slider set to "1.0 averages", displayed in a window at the bottom. Because random noise has a large variance, it will fluctuate rapidly. Many such spectra must be averaged to obtain a smooth curve. The spectrum is shown as level in dB against frequency in Hz.
- Moving the cursor in the plot window displays the frequency and relative power spectral level, referred to a zero level at top of the window, in a box at the bottom.
- Slowly move the "FFT average" slider up until its information window shows 200 - 400 averages. The plot will asymptotically become smoother. You may need to wait for 20 - 40 seconds until it reaches a stable shape.
- Select "File/Save FFT to file" or "File/Save FFT to clipboard" (top panel). The spectral values are now capured as two-column, tab-delimited text which can be saved and/or plotted. The program Plotspec 4 by Gary, ZL1AN, is convenient for further manipulating this data.
Plotting the Passband using "PlotSpec":
"PlotSpec" can also be downloaded from this website. It produces a labelled power spectrum plot which can be zoomed and re-sized for pasting into other documents.
- Start PlotSpec.
- Stop Spectrum Analyser with the "stop" button.
- On the top toolbar, select "File/Save FFT to clipboard" .
- Move to the PlotSpec window. On the top toolbar, press "Paste." You should see the plot data appearing in the left-hand windows.
- See the PlotSpec "Help" file for details re manipulating and capturing the plot.
Additional controls:
The program has to be stopped (press the Stop button) to change any of these.
- The "FFT window" window (top right) allows the spectra to be shaped by one of 6 alternative window functions. The default "Blackman" window is suitable for most applications. See Wikipedia for an explanation of how these windows differ. You won't see much difference between them.
- Three different sampling rates can be selected using the "Sample rate" radio buttons. The default is 44100. Reducing this changes the maximum frequency displayed on the plot, and also its frequency resolution.
- 44100: Maximum frequency 22 kHz, resolution 43 Hz.
- 22050: Maximum frequency 11 kHz, resolution 22 Hz.
- 11025: Maximum frequency 5.5 kHz, resolution 10 Hz.
The lower sampling rates update the spectrum more slowly. The 11025 rate is most suitable for examining the fine structure of a spectrum, but you'll have to wait longer for the plot to stabilize.
- You can select either linear or logarithmic frequency displays, which change the frequency axis. The linear display is conventionally used for DSP analysis, and is what Plotspec expects. The logarithmic display shows a conventional Bode plot. The linear display is usually better for examining the spectrum.
Program details:
Each spectrum is captured with a 1024 point FFT. A selected number are averaged to obtain a smooth plot.
A visual "zoom" function is provided. If you click the left mouse button and drag the mouse across the spectrum display that section of the display will be highlighted in white. Release the button and that section of the spectrum will be "stretched" across the entire screen. It does not provide any more resolution though; it just makes it easier to see finer details. Left-click the mouse button again and the screen will return to normal.