Spectrum Lab Circuit Components

Spectrum Lab is more than a simple audio spectrum analyser. It can be used for other purposes like filtering, decoding, receiving & demodulating VLF signals with the soundcard (or other audio input devices). The following components can be activated or controlled in the Component Window:

See also:  Spectrum Lab's main index ,  sample applications .


Component Window

This window shows an overview of the main function blocks in a "circuit-like" style. It can be opened from SL's main window (View/Windows...Components).
Note: There may be more components in the component window than shown here.

 

 

The actual state of most components is indicated by their color. Green means active, gray=passive, red=error(s) occurred; not shown in the legend: light blue means "parameter is selected for editing or connected to the slider on the right", and yellow means "active but waiting for something" (like the trigger).

Most components and connections may be changed (switched/connected/activated) by clicking on them.

You get more information about a particular component by clicking on its function block. This will open a special window, for example clicking on the "Input Monitor"-block will turn the input monitor on and switch the focus its window.

If a component is painted red, there may be an overload condition, a problem with SL's real-time processing, or a connection to an invalid source because the source label is currently unavailable (for example in monophone mode, you cannot use R1..R5). If a component turns red, you should...

If an adder stage is colored red, it will most certainly be overloaded and the output is "clipped". Reduce the input levels in this case, or use one of the monitor screens to observe the waveforms.

The vertical slider on the right side of the circuit window can be used to modify the selected parameter (which is colored light blue then). The slider can be connected to one of many parameters (for example, the gain of an amplifier). To connect a parameter to the slider, click on one of the components in the diagram or select it in the combo box under the slider. The actual value (+unit) is displayed in numeric form below the selection box. Some parameters can be connected to the slider by clicking at them in the circuit.

Chaining of both processing branches (since 2004-07)

As you can see in the screenshot of the circuit window, it is designed to process two channels simultaneously ("stereo") but the program can also operate in single-channel-mode ("mono") to reduce the CPU load.

Alternatively, you can let the audio run through both branches (formerly "left" and "right") to have up to four DSP blackboxes and two custom filters. To let a monophone audio stream pass through both branches, click on the small "chain switch" which is near the output node of the left channel ("L5"). The signal path will be modified as shown in the screenshot on the left:
The signal from "L5" (left output) will be routed to label "R1" (right input), run through the lower processing branch (R1->R2->R3->R4->R5), and finally reach the digital/analog converter (usually the soundcard's "line out" signal).
To get back to the normal un-chained mode (two separate channels), click on the chain switch again (R1 in the box).

back to top


Monitor Scopes

These "small scope windows" can be used to watch the waveform of the input- and output signals. The main purpose is to check the proper amplitude of incoming and outgoing signals.

 

 

The display can be magnified in the vertical and horizontal axis ("Vmag" and "Hmag"). With "Vmag" set to 1, the signal should never touch either the top or the bottom of the scope screen. Overload conditions are especially critical at the input from the sound card, because "clipping" will produce unwanted signals on the spectrogram or in the output signal. If a signal is too strong (only 3dB below the clipping point), it will be colored red instead of green on the scope screen.

On the other hand, if the input amplitude is too low (and not visible with "Vmag=1"), you are wasting a lot of the A/D-converters resolution. You may magnify the vertical axis to 1000, and try if you can see a signal then. This is especially important if you use an external converter (or soundcard) with less than 16 bit resolution. Increase the gain before the A/D converter (or inside the soundcard, with the volume control utility).

A few more options like trigger settings may be found in a popup-menu. Right-Click into a scope window to see the options. Please note that the scope's trigger has got nothing to do with the "Universal Trigger Block", the scope's trigger is just a simple zero-crossing detector.

For more sophisticated analysis in the time domain, use the time domain scope (explained in a separate document).

back to top


Universal Trigger Block

This function block can be used to control:

The configuration of the trigger itself does not depend on where it is connected to. The trigger symbol is visible in the circuit window, it may look like this:

The following trigger parameters can be modified by clicking on the trigger function block in SL's circuit window. Some of them can be connected to the value slider in the circuit window.

screenshot of trigger (popup menu)

If no signal is detected for over a second (or so), the trigger box in the circuit window turns yellow instead of green.

To use the trigger for the main waterfall, set the option "triggered spectrum" on the setup screen.

There is one sample file in the installation archive called "TrigWat1.usr" which demonstates how to use the trigger function block for the waterfall. It uses SL's test signal generator to set the scrolling speed of waterfall.

back to top


Test Signal Generator

The test signal generator consists of...

More details about the test signal generator and its control panel can be found in this file.

back to top


Programmable Audio Filter

There are programmable filters in the center of both processing branches (for left and right channel, but they can optionally be chained as explained here).  The internal functions of these filters are explained in another file. Since November 2003, there is an FFT-based filter implemented in SpecLab which can also be used as an auto-notch filter and lowpass, highpass or bandpass simultaneously.

Some general notes about the audio filter blocks inside the circuit window:

If a filter is turned off (grey color in the diagram), it is not necessarily bypassed ! To turn a filter on/off, or activate a bypass (around the filter), open the filter's control window by clicking at the filter function block in the circuit diagram. The different states of a filter look like this in the circuit window:

Filter on (running), and is NOT bypassed, filtered audio arrives at the right side)

Filter off, bypassed (audio passes unchanged from left to right)

Filter off, NOT bypassed (no audio arrives at the output on the filter's right side)

back to top


Frequency Converter ("mixer")

The frequency converter is only required for special signal processing. It can be used to shift frequencies. This is achieved by multiplying a signal with the output of a sine wave generator ("local oscillator") which optionally can be a two-phase oscillator for sideband-rejecting frequency conversion.

To configure one of the frequency converters, click on its symbol in the circuit window.  A popup menu like this will appear:

screenshot of mixer popup menu

The frequency of the local oscillator can be set in the Component window. Click on the frequency display of the local oscillator and enter a new frequency, or connect the oscillator frequency to the value slider on the right side of the component window. See notes on the VLF receiver below for other ways to control the frequency.

To turn the frequency converter on (or off), left-click on its circuit symbol in the component window. As long as the frequency converter is "off", it will pass the input to the output without any change.

Notes on this frequency converter:

 back to top


Audio input and output

This is usually the PC's soundcard, but it can also be another source or destination (an "audio server" as explained in the configuration dialog).

back to top


Output- and "cross coupling" amplifiers

After all sorts of filtering, the remaining signal amplitude at the output may be much weaker than the input signal. To adjust this without wasting much of the D/A-converters dynamic range, all signals which go into the output adders can be multiplied with an adjustable gain factor.

To modify the gains, click on one of the amplifier symbols in the circuit diagram. The value slider on the right side will then be connected to the amplifier. The gain of the "normal" amplifiers is shown in DECIBELS (dB). Zero means "unity gain", positive values amplify the signal, negative values mean attenuation.

Only the "cross-coupling amplifiers" (between left and right channel) use a linear GAIN FACTOR: one means unity gain, zero turns the coupling off, and negative values can be used to SUBTRACT signals in one channel from the other. In 99.9 percent of all applications, the cross-coupling factors are set to zero, in this case their symbols are painted gray in the circuit window (="passive").

A little gimmick: With both cross-coupling amplifiers set to "-1" (which means subtract left channel from right, and subtract right channel from left), it is sometimes possible to remove the vocals from a music recording ... remember this if you are a Karaoke fan ! Why does this work (sometimes) ? Often the singer's voice is recorded more or less monophone, and mixed equally to the left and right channel, while the instruments have either a phase different or are not equally strong in both audio channels.

New (since 2004-07): You can -alternatively- control the output volume with an automatic gain control function, which is part of every DSP blackbox.

back to top


Spectrum analyser

The spectrum analyser can be connected to the audio input or output. The output of the spectrum analyser (FFT) can be visualized as spectrum graph or waterfall, as explained here.

Click into one of the analyser's input blocks to select the source for that channel. The second channel can also be turned off this way (by connecting it to "nothing", which is on top of the selection list for the 2nd channel).

The spectrum analyser can be configured in a special setup screen, which can be opened by clicking into the analyser block in the circuit window (through a popup window, like for many other function blocks in the circuit window too).

Since May 2004, the spectrum analyser can be triggered externally, using the 'universal trigger' function.

back to top


DSP Black Boxes

The "DSP Black Boxes" can be used for very special digital signal processing. These functions can be realized (at least):

The test circuit in Spectrum Lab has four black boxes (left+right channel, before and after the converters and filters). For every blackbox, an independent combination of this functions can be selected.

The properties of each "Blackbox" can be modified by left-clicking on a blackbox symbol () in the component window.  A popup menu like this will appear:

Some of the blackbox components can be accessed through interpreter commands and -functions.
In the following chapters some of the functions in a DSP blackbox will be explained.

Delay line in a DSP blackbox

The 'internal' function of a black box (if used as delay line, echo, or crude hum suppressor) is this:

To use this as simple amplifier or attenuator:
set "Input Factor" and "Feedback Factor" to zero, use "Bypass Factor" as gain control
To use it as delay line with unity gain:
set "Input Factor" to one, "Feedback" and "Bypass" to zero
To generate a single echo:
set "Input Factor" and "Bypass Factor" to one (or similar) and "Feedback" to zero.
For audio effects, an echo delay time of 0.5 seconds is a good value.
To generate multiple, slowly decaying echoes:
set "Input Factor = 1", "Feedback Factor = 0.8" (or so), and "Bypass = 0.8"
Suppressor for 50 Hz-hum and harmonics (from European AC mains):
set "Delay Time = 0.02 sec", "Input Factor = -0.7", "Feedback Factor = 0", "Bypass Factor = 0.7"
(Factors of -1.0 and +1.0 also work, but they amplify the signal). This removes 50 Hz (1/0.02sec) and all harmonics of 50 Hz by adding the signal delayed by 20 ms to itself. Tnx Eric Vogel and Renato Romero for this idea.
In countries with 60 Hz AC mains, try  0.01667 sec (to remove 60 Hz) or 0.05 sec delay (to remove 20Hz(!) and harmonics). In the input field, instead of typing "0.01667" you may also enter "1/60", etc. The formula will calculated when you click the "Ok" button of the numeric input box.
There is also a dedicated hum filter using an algorithm by Paul Nicholson, which does not occupy the "delay line". You can activate it from the DSP blackbox popup menu. Set the "Nominal Hum Frequency" to either 50 or 60 Hz, and activate the hum filter (so it appears checked in the menu).

Advanced hum filter in a DSP blackbox

This filter is based on an algorithm by Paul Nicholson, for more explanations see http://www.abelian.demon.co.uk/humfilt/ .

To use it here, you just have to specify your AC mains frequency (50 or 60 Hz). The filter tracks this frequency within a certain range to place the sharp nulls of the comb filter exactly on the mains frequency and its harmonics. This only works if the mains frequency is quite stable (so not for "wandering carriers" in a shortwave receiver, caused by free running switching-mode power supplys). Alternatively you can provide an external source for the AC mains frequency, for example: let the spectrum analyzer detect the precise mains frequency (see below how to achieve this).

There is a control panel for the hum filter which can be connected to one of the four DSP blackboxes. To open the control panel, right-click on the DSP blackbox in the circuit window, point on the "hum filter" menu (so the submenu opens), then click on "Show Control Panel". On the control screen for the hum filter, you can modify...

In the lower part of the window, some actual values from the tracking algorithm are displayed. They were mainly used for testing purposes, but the "Current hum frequency" may be interesting for you (dear user) as well.

An alternative source for the current mains frequency:
Just let the spectrum analyzer detect the precise hum frequency. Use the peak_f() function, like peak_f(#1, 48, 52) or peak_f(#1, 58, 62). Load the preconfigured settings "HumFi50.usr" or "HumFi60.usr" and open the hum filter control window. The peak-frequency-detection routine is entered in the edit field under the checkmark "Calculate current hum frequency from expression". Note that the 1st channel (#1) of the frequency analyzer (which feeds the waterfall) is connected to the INPUT of the DSP blackbox (labelled "L1"). Be careful not to connect this channel to "L2", because the 50 Hz / 60 Hz signal is notched in the output of the DSP blackbox !
For accurate tracking we need a good SNR of the 50 Hz / 60 Hz line, otherwise the interpolation in the peak_f function is severely degraded. If your VLF antenna does not pick up enough hum, switch the program to "stereo" mode and use the second input of your soundcard as an auxiliary hum input. Use an insulated piece of wire as "hum antenna", tied around a power cable or similar. Connect one input of the spectrum analyzer to this auxiliary hum input. The result can be stunning if you are listening to VLF with the soundcard !

Hard Limiter in a DSP blackbox

The limiter simply clips the waveform to one of two possible adjustable "maximum" values:

The program will automatically use the lower of these two limits.
When opening the submenu "Hard Limiter" in the popup menu of a DSP blackbox, the program may show a message like this (if the limiter is enable) :

"Signal is 10.4 dB below clipping(A); avrg = -12.3 dBfs" .

This means (for example) :

At the moment, the input signal (to the blackbox) is 10.4 dB below the lower of the two clipping levels,
the lower is clipping level A (see above), and the average input signal is 12.3 dB below full scale.

To adjust the two clipping levels (A and B), these parameters can be connected to the vertical slider in the circuit window.
Select "Hard Limiter"..."Clipping Level A" (or B) in the blackbox menu, and when prompted for the new value, set the option "Connect to slider".

Hint:
Connecting the Hard Limiter in front of the digimode terminal may help under certain (special") conditions, for example with the PSK31 decoder.
Also, it helps when listening to shortwave radio stations if the signal is affected by static crashes. Because the signal first runs through the limiter (before it enters the optional AGC), the deafening effect of deafening effects from thunder can be reduced. Unlike the Noise Blanker (see below), the Hard Limiter doesn't punch a "hole" into the signal. A combination of the Limiter and the Noise Blanker is possible, but makes little sense.

Noise Blanker in a DSP blackbox

The noise blanker can be used to suppress pulse-type noise, as often caused by electric fences, switches, and thunderstorms. It basically works like this:
If the signal rises above the average by more than a certain amount (expressed as "Trigger peak / averag" in decibel) within a short time, and only for a short duration, the "gain" of the noiseblanker will be reduced by this amount. The gain reduction will have smoothed ramps (rising and falling edges) to avoid AM sidebands in the output signals.
The adjustable parameters of the noiseblankers are:

Modulators and Demodulators in a DSP blackbox

In each of the four DSP blackboxes, there is a "modulator"/"demodulator" function for either amplitude-, frequency- or phase-modulation. It can also be used for frequency conversion (like the multiplier, but with sideband rejection using the Weaver method).

Depending on the type, you must specify:

(more info here in future versions)

To modify the properties of a modulator/demodulator, click on the DSP blackbox in the circuit window to open a DSP popup menu.

Wideband FM reception

For wideband FM, activate the FM deemphasis unit (which is nothing more than a digital implementation of a simple RC lowpass filter). For north american FM stations, use a time constant of 75 microseconds. For the rest of the world, use 50 microseconds. The configuration "UKW_FM_Demodulator_SDR_IQ.usr" or "UKW_FM_Demodulator_Perseus.usr" can be used as a starting point to receive FM broadcasters with one of these software-defined radios. In these configurations, the left part of the spectrum analyser shows the input spectrum (before FM demodulation), while the right part shows the demodulated baseband signal. The FFT-based filter is used as an IF filter in the above configurations. The IF bandwidth can be adjusted with the blue frequency marker in the left part of the spectrum (it is actually one of the programmable frequency markers). Stereo reception and special functions like RDS decoding is not possible (yet ?). But you may be able to see the stereo (L-R) subcarrier, double-sideband modulated around 38 kHz, and the 19 kHz stereo pilot tone at 19 kHz in the right half of the spectrum display.
Using a normal soundcard (and a VHF downconverter of course) to receive wideband FM is impossible due to the lack of necessary bandwidth. Only soundcards with a sampling rate of 192 kHz can be used to receive FM with just a simple downconverter.

Automatic Gain Control as last stage in a DSP blackbox

For listening to certain signals comfortably, without damaging your ears if the signal suddenly gets too strong due to QSB (fading), you may want to have a constant output level (on average) despite changing strength of the input signal. This is especially helpful when using SpecLab as the last stage of a radio receiver, or as a complete VLF or LF receiver. Use the AGC (automatic gain control) which is the last processing stage within a DSP blackboxes.

To turn the AGC on or off, or switch between "slow, mid, and fast" mode, use the DSP popup menu in the circuit diagram, and point to the "Automatic Gain Control" entry. A submenu with the following entries will open:

back to top


Sampling Rate-  and Frequency Offset Calibrator

The small blocks labelled "SR cal" and "FO cal" in the circuit diagram show the current status of the sampling rate- and frequency offset calibrator.  Clicking on one of these blocks opens a control panel where the properties of the calibrators can be edited, etc.

More info about these frequency calibrators are explained in another file.

back to top


Interpreter commands for the test circuit

blackbox[N].xxx
Access to some of the DSP blackbox components. "N" is the blackbox number:
0=blackbox near left input, 1=blackbox near right input, 2=before left output, 3=before right output.
The following blackbox components can be accessed this way (most read- and writeable):
blackbox[N].agc.mode : 0=off, 1=fast, 2=medium, 3=fast, 4=custom (see attack,decay)
blackbox[N].agc.tgt_level : target output level in decibel
blackbox[N].agc.min_gain : minimum gain of the AGC block in dB
blackbox[N].agc.max_gain : maximum gain of the AGC block in dB
blackbox[N].agc.mom_gain : momentary gain of the AGC block in dB, read-only !
blackbox[N].agc.attack : custom-defined attack speed, arbitrary unit. 1.0 is "very fast", 0.01 is medium speed
blackbox[N].agc.decay : custom-defined decay speed, same arbitrary unit as the attack speed
circuit.osc.freq
Reads or sets the oscillator frequency (in Hertz) for the frequency converter.
If you use the stereo mode and two different oscillators:
circuit.osc[0].freq is for the LEFT audio channel,
circuit.osc[1].freq is for the RIGHT audio channel.
Example: VFO control for the "VLF radio",
sr_cal.xxxx
Sampling rate calibrator.
fo_cal.xxxx
Frequency offset calibrator (or "drift detector")
See also:
Commands to control the digital filters
Overview of all interpreter commands
back to top