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:
- Audio input and output (usually the soundcard, but other sources/destinations are possible too)
- Input Preprocessor : Can be used to reduce the CPU load by decimating the input sampling rate, etc .
- Signal generator
- Oscillator and Multiplier (local oscillator + "Mixer" for frequency conversion)
- Programmable audio filter
- Output- and cross-coupling amplifiers
- Spectrum analyser
- Monitors (small oscilloscopes)
- Time Domain Scope (larger oscilloscope, explained in a separate document)
- Universal Trigger Block (for triggered data acquisition)
- Counter / Timer (pulse- or event counter, operating in the time domain)
- Black Boxes (special DSP functions: Adder/multiplier for two channels, IIR bandpass filter, noise blanker, hard limiter, delay line, hum filter, chirp filter, modulators+demodulators, automatic gain control)
- Sampling Rate- and Frequency Calibrator
- Interpreter commands for some components of the circuitry
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. In many cases, 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...
- Click on the red panel, you may get more information about the error
- Turn on the debugging window from the main window of the program
- It the program "feels sluggish", turn off all components you don't really need to save CPU power, or make the waterfall display a bit slower
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 following labels are similar as 'nodes' in an electronic circuit. These labels are also used in some interpreter functions to define the source node :
- L1 : Left input from the soundcard, or in-phase component from a software defined radio
- R1 : Right input from a soundcard, or quadrature component from a software defined radio
- L2 : Output from the first DSP blackbox (see circuit diagram above), etc etc ...
L5 : This was (formerly) the output from the processing chain
to the left audio channel of the soundcard, D/A converter, or similar.
Since the introduction of the 'output switches' (near the DAC block) in V2.81, the signal from 'L5' may also be routed to the right audio channel.
R5 : This was (formerly) the output from the processing chain
to the right audio channel of the soundcard, D/A converter, or similar.
The image below shows the default position of the output switches.
Some less frequently used combinations of the above are used by certain functions
to define the source taps for a complex signal (I/Q input), for example the
and amplitude monitor function) :
- L1R1 : combination of L1 (inphase) and R1 (quadrature phase), etc .
The vertical 'value' 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).
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).
This function block can be used to control:
- the main spectrum analyser
- the time-domain scope
- the triggered audio recorder
- and -possibly- a few other functions too.. but not for the Counter/Timer module (which has its 'own' trigger function) !
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
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.
- Trigger source (in the small square, connected to the trigger block). If you don't need the trigger, disconnect the input to save CPU power. To change the source, click on the small square with the short source name (like "L1" in the screenshot).
- Trigger level, ranging from -32767...+32767 (linear steps from a 16-bit A/D converter). Can be changed in the popup menu after clicking into the trigger box, and connected to the value slider on the right side of the component window.
- Trigger slope/polarity: positive, negative, or both edges
- Trigger hysteresis: can be used if the trigger signal is noisy. Make the hysteresis value a bit larger than the noise (peak-peak value). For example, using a positive slope with hysteresis: A trigger event will only occurr, if the input voltage falls below (level-hysteresis/2) and then rises above (level+hysteresis/2). This parameter can also be connected to the slider to change this parameter on the fly.
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.
Counter / Timer (pulse- or event counter, operating in the time domain)
The counter/timer can be configured through its context menu in the circuit window (click on the box titled "Counter"). The configurable parameters are:
At the time of this writing, only the 'Counter' mode was implemented. If
you don't need the counter (and want to save CPU time), set the Counter/Timer
mode to 'OFF' in this menu.
- Source 1, Source 2 :
Select the source for the counter's "main" and "auxiliary" input. If the
auxiliary input is used at all, only certain combinations are possible: L1/R1,
L2/R2, L3/R3, L4/R4, L5/R5 but nothing else.
- Trigger Level :
Sets the trigger level, expressed in PERCENT of 'full swing'. A trigger level
of zero means 'trigger when the signal crosses zero'. A negative value triggers
on the 'negative half wave', which makes sense if the measured signal is
mostly zero, with short negative pulses. Generally, for the best accuracy,
set the trigger level near the steepest pulse of the waveform. This would
be zero for a sine-wave like signal, and some positive value (about half
the peak pulse amplitude) for rectangular pulses.
Note: The Counter/Timer uses its own trigger module, which has nothing in common with the 'Universal Trigger Block' .
- Trigger Hysteresis :
Can be used to reject noise, to prevent false triggers (counts). For example,
the pulse output of a certain Geiger Counter was superimposed with a 2500
Hz sinewave, amplitudes approx. +/- 10 %, and a pulse amplitude of over 90
% (all percentages relative to "full input swing" of the soundcard's A/D
converter). To avoid counting the sinewave, the Trigger Hysteresis was set
to 10 % in this example, and the Trigger Level to 50 % .
- Trigger Slope : Rising or Falling.
Defines if the rising (leading) edge of a pulse shall be registered. For
simple frequency counter, it really doesn't matter. But for pulse timing
measurements (for example, to compare the PPS outputs of two different GPS
receivers), make sure you pick the right slope. Also beware that certain
soundcards (for example, the E-MU 0202) seem to invert the analog input's
polarity ! A short "positive" pulse on the analog input appeared as a short
"negative" pulse in the digitized output !
- Gate Time :
Number of seconds for a complete measuring cycle.
Note: The counter updates the result more frequently than the gate time. Furthermore, the frequency measurement not only uses the "number of pulses per gate interval", but also takes the timestamps of individual pulses (events) into account. Thus, even with a one-second gate time, the resolution is better than 1 Hz. But the accuracy greatly depends on the waveform (!), noise, hum, etc. Thus the requirement to set the counter's trigger level to the best possible value.
For largely dispersed signals (like the output of a Geiger counter) use a long gate time, for example 100 seconds as in the 'Geiger Counter' test application (GeigerCounter.usr).
- Holdoff Time:
Can be used to ignore two pulses which are very close to each other. For
example, there may be 'ringing' for a few milliseconds at the output of a
Geiger counter, or the output may be a synthetic tone burst of a few dozen
milliseconds. In such cases, use a non-zero Holdoff Time to avoid counting
the same event (particle, etc) twice.
If you don't need the holdoff function, set the holdoff time to zero. The holdoff time also limits the maximum count rate ! For example, with a 20 millisecond holdoff, it's impossible to count more than 50 pulses per second.
The counter's input (source) can be selected by clicking on the source selector, like most other elements in the circuit window.
The measured results (like frequency, total event count, etc) can be retrieved through the following interpreter functions :
counter.freq: returns the measured frequency in Hertz for the first channel (main input)
The resolution depends on the counter's mode of operation, and especially
the configured gate time.
Note: The result is always scaled into Hertz (SI unit for the frequency), even if the gate time ist much longer than one second. To convert the result into something exotic like "particles per minute", multiply the result with 60 (or any other factor you like).
counter.event_count: returns the current value of the free-running event counter.
- Read-only. Integer result. Not related to the gate time. Starts counting at zero (when the counter was started), and never resets until the program terminates.
The input preprocessor can be used to decimate the input sampling rate before any further processing step. This may decrease the CPU load, because all later processing stages don't need to run at the 'full pace'. For example, you may only be interested in a 1 kHz wide frequency band around 77.5 kHz (including digital filtering, demodulation / decoding, etc). The soundcard would have to run at 192 kSamples/second, but the rest of the test circuit (including the spectrum analysers) only needs a fraction of that sample rate.
Besides decimation (which means reduction of the sampling rate, along with appropriate low-pass filtering), the preprocessor can also move an signal down in frequency, and turn it into a complex signal ... if the input isn't already complex.
The Input Preprocessor can be configured by clicking on its symbol in the circuit window. This will open a popup menu with the following items:
- Configure Input Preprocessor ...
Frequency Shift ...
turn off : Turns the frequency shift off.
Decimation without frequency shift is possible, the processable frequency range starts at 'zero Hertz' then.
Without frequency shift, the input preprocessor requires less CPU load, so if you don't need frequency shift at this stage, turn it off.
turn on : Turns the frequency shift on.
The input signal will be moved down by this frequency (in Hertz) before decimation, i.e. before bandwidth limiting.
- modify center frequency : Opens an edit box to modify the center frequency.
- turn off : Turns the frequency shift off.
Decimate By .. ( 1, 2, 4, 8, or 16 )
Reduces the sampling rate, and thus the usable bandwidth, by the specified ratio.
- Help (on the input pre-processor) : open this page in the manual .
Future plan (!) : The preprocessor's output can also be processed
by other instances of Spectrum Lab. This helps to reduce the total
CPU load, if only a narrow frequency range shall be processed by all
running instances. For example, the first instance may receive data from
a software defined radio (like Perseus, SDR-IQ, or soundcard-based), move
down the interesting frequency range, decimate the sampling rate even further,
and then send the decimated stream to all other instances. You can use this
feature to have up to 20 (!) instances of Spectrum Lab analysing a lot of
narrow frequency bands, all fed by the first instance.
At the moment, an external DLL (e.g. Audio-I/O-DLL) is required to distribute an audio signal 'processed' by one SL-instance to other instances.
The test signal generator consists of...
- three independent sine wave generators (other waveforms too)
- one noise generator
- AM and FM modulator for each sine wave generator
More details about the test signal generator and its control panel can be found in this file.
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 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
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:
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:
- There is a number of options for the frequency converters, they may be used as up- and downconverters, for either upper or lower side band, or both side bands (which is the least CPU-power consuming mode)
- There is an interpreter command to control the oscillator frequency: "circuit.osc.freq" can be used to read or set the oscillator frequency. This is used as VFO control for the "VLF radio", where the oscillator frequency is connected to a movable marker on the frequency scale (including audio offset).
- Multiplying a real signal (frequency f_in) with the local oscillator's frequency f_mix, (f_mix + f_in) and (f_mix - f_in) are generated. The "unwanted sideband" can be suppressed by selecting the proper mixer type ("USB down-converter", etc). These mixers for real signals require more CPU time than the "complex multiplier" because of the extra filtering.
- Multiplying a complex input signal ("I / Q"; inphase+quadrature) with a complex oscillator signal does NOT produce an extra sidebands. Instead, the signal will be simply shifted up or down in frequency, without the need for extra filtering. To use this configuration, select "Complex Multiplier" in the popup menu shown above.
- There is a file distributed with SpecLab which can turn your PC into a VLF receiver (ranging from almost DC to 24 kHz). The frequency converter is used as "LO" in that configuration, its frequency can be controlled by one of the markers on the frequency scale of the spectrum (very handy in combination with a narrow band filter!).
Instead of the frequency conversion in the time domain, consider using the
FFT-based audio filter, which includes
an option to shift audio frequencies up/down, and also an option to invert
frequencies (i.e. turn USB into LSB and vice versa). In many cases, the FFT-based
filter implementation requires less CPU power than the traditional
multiply-and-filter method used in these frequency converters.
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).
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.
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.
The "DSP Black Boxes" can be used for very special digital signal processing. These functions can be realized (at least):
- Adder or multiplier to combine two channels (additive or multiplicative)
- Bandpass filter (often used as 'preselector' before demodulators or similar)
- Hard limiter (aka "clipper") can limit the wave form to a certain value
- Noiseblanker: can be used to remove pulse-type noise
- DC reject: a high-pass filter with an edge frequency of about 0.1 Hz, to remove or measure the DC component
- delay line: usable for single echo, multiple echo, crude harmonic hum eliminator
- attenuator or amplifier : use "factor" in a delay line to amplify or attenuate
- advanced hum filter (algorithm by Paul Nicholson)
- AM + FM modulators and demodulators, phase modulator, phase demodulator
- First order lowpass filter, required for wideband FM deemphasis (in the signal path after demodulation)
- Automatic Gain Control (AGC)
- Chirp Filter
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.
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.
The order in which the signal runs through a blackbox may be subject to change (or even EDITABLE in a future version), but at the time of this writing (2010-10-16) it was the same sequence as visible in the DSP blackboxes' configuration menu. For example, when active, the adder / multiplier is the first processing step in each box.
If a different processing sequence is necessary, use two blackboxes in "series". For example, use the blackbox between L1 and L2 (see circuit window) as the first stage, and the blackbox between L4 and L5 as the second stage. Remember to switch the FFT-based filter (between these two boxes) into bypass mode when the filter is not active - otherwise the signal path from L2 to L4 will be 'open' (not connected).
This function of the DSP "blackbox" combines the input from two sources into one output signal. The sources cannot be selected freely, but are fixed:
- the first input into the adder/multiplier is the one shown in the circuit window, eg "L1" for the blackbox between L1 and L2.
- the second input is on the complementary signal path, eg "R1" for the blackbox between L1 and L2 (!) .
The gain factors can be individually adjusted through the DSP blackboxes' context menu:
In contrast to the FFT-based filter (which is not part of a DSP blackbox), independent bandpass filters can be activated in any of the DSP blackboxes. These filters are implemented as simple 8-th or 10-th order IIR filters, which can be configured through the context menu in the circuit window (left-click on a DSP blackbox, then select "Bandpass Filter" to see all possible options) . The other properties of these bandpass filters are also configured through the context menu in the circuit diagram (there is no extra dialog window for these filters).
The properties of a bandpass filter are:
- Enabled / Disabled (bypassed in the signal path)
- Center Frequency in Hertz (like many other parameters, this value can be 'connected' to a slider in the circuit window)
- Bandwidth in Hertz
Filter Response Type :
- 10-th order Bessel (linear phase, constant group delay, but soft transition from passband to stopband)
- 10-th order Butterworth (no ripple in passband and stopband)
- 8-th order Chebyshev filters with different amounts of passband ripple (tradeoff ripple vs "sharpness" of the cutoff)
- 10-th order Gaussian filters (no overshoot to step input functions, minimum group delay)
These bandpass filters are the first (?) stage through which the signal runs in a DSP blackbox, because it was first used to limit the frequency range entering a limiter or noiseblanker (to suppress Sferics on VLF without being irritated by mains hum, and VLF transmitters).
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"
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).
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...
- the nominal hum frequency (usually 50.0 or 60.0 Hz)
- the end stop for the possible hum frequency (in percent, 0.5 should be ok)
- the number of filter stages (the higher this value, the narrower the notches of the comb filter)
- the slew rate (the maximum adjustment speed for the built-in tracking algorithm)
- selection of the tracking algorithm (several versions of Paul's algorithm implemented here, plus the option to turn automatic tracking off)
- tracking cycle: Defines how frequently the current hum frequency is revised by the algorithm. A good point to start with is 0.5 ... 1 seconds.
- "Calculate current hum frequency from numeric expression": Uses SpecLab's interpreter to define an alternative source for the current hum frequency (mains frequency). See example "An alternative source.." below.
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 !
The limiter simply clips the waveform to one of two possible adjustable "maximum"
Clipping level A :
This limit doesn't depend on the signal amplitude itself. It is entered in "dB over full scale". A "full scale" value of 0 dB is the point on which clipping takes place in the A/D, and in the D/A converter. Typical settings for this parameter are -3 to -6 dB "above" full scale (note the negative dB values; the limits are actually always below full scale).
Clipping level B :
This limit is relative to the average signal amplitude. 3 dB means "clip anything which is 3 dB above the average signal level".
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".
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.
The noise blanker can be used to suppress pulse-type noise, as often caused
by electric fences, switches, and thunderstorms. It basically works like
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:
Set to 0.01 seconds by default, to reduce sidebands caused by the blanker's amplitude modulation. If the noise pulses are very short (typically shorter than 10 milliseconds), reduce this value. Remember, you can connect (almost) all parameters to the value slider in the circuit window.
Trigger level ( ratio of peak to average in decibels)
Defines the level at which a blanking pulse shall be started. The average value is taken from the input signal, full-wave rectified, and low-pass filtered. Thus values below 3 dB are useless - at least for a few very special cases. Don't make this value too low, to prevent false triggers. 20 dB seem to be a good value for listening on longwave. With this value, the effect of "QRN" (static crashes) on a waterfall display can be reduced also. It takes some experimentation to find the best value for a given purpose - remember the value slider..
Pre-trigger blanking time (t1), post-trigger blanking time (t2) :
Can be set to zero in most cases. In some cases (depending on the 'waveform', see red graph in the diagram), blanking can actually start a short time (t1) before the trigger threshold is reached, and extend a short time after the signal falls below the trigger threshold. Quite annoying for listening, but it may help to reduce the unwanted energy from sferics in weak signal analysis (with very long FFTs, where a slightly longer gap in the input matters less than the 'burst noise' energy).
Average detector time constant
This is the lowpass filter's time constant (in seconds) for the average value. Typically a few seconds. Example (VLF, sferic blanking): 5 seconds.
Note: In some cases, it helps to run the signal through a bandpass filter before it enters the noiseblanker (or similar non-linear processing stage). For example, if the input from the receiver (soundcard, SDR, etc) contains strong signal which are *not* impulsive noise (and thus shall not trigger the noiseblanker), a bandpass filter which rejects the non-impulsive noise helps to prevent false triggers of the blanker, and allows setting the trigger level to a lower value. In a VLF radio experiment, the combination of a bandpass filter followed by a noiseblanker was used to remove sferics (distant lightning discharges) before the signal entered the spectrum analyser, which used a very large FFT to dig a weak but coherent signal out of the noise.
Similar to a 'coupling capacitor' in an audio amplifier, a signal's DC component can be removed. This is achieved by a simple 1st-order highpass filter with a lower corner frequency of approximately 0.1 Hz .
When enabled, the (removed) DC offset can be read (measured) with the interpreter function 'blackbox[N].dc_offset' .
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:
- center frequency
- modulation bandwidth
- carrier amplitude
- modulation factor
Possible types are selectable through the blackboxes' specific menu (left-click on the symbol in the circuit diagram... see below):
- Amplitude modulator
- Frequency modulator
- Phase modulator
- Amplitude demodulator
- Frequency demodulator
- Phase demodulator (note: the output is scaled to -180 to +180 degrees, which may change in future revisions, when "everything" will be normalized to +/- 1.0)
To modify the type or 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
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.
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:
allows to switch the AGC on/off or select the speed. The "slow" AGC is the most comfortable mode for longwave- and shortwave listening.
defines the "target" average level of the AGC'ed signal, expressed in "decibel before clipping takes place". For sine-like signals, a value of -3 dB is ok, for other pulse-like signals which require more headroom, set the Target Level to -6 dB or even less.
Min. Gain, Max. Gain
can be used to limit the gain range of the AGC. If there is "no signal at all", you may want to limit the gain to avoid hearing a hissing broadband noise in your speakers. A maximum gain between +60 and +80 dB is usually sufficient, but this depends greatly on your application.
shows the momentary gain of the AGC control loop. If you connect this value to the slider in the circuit window (by checking "connect to sllider" mark in the edit window after selecting this menu), you have a "living" display of the current gain depending on the averaged input amplitude.
For experiments with a chirp sounding, or a chirped backscatter radar, a chirp filter was added to all of the four DSP blackboxes.
Details about the chirp filter are in a separate document (chirp_filter.htm) .
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.
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
blackbox[N].dc_offset: reads the current DC offset voltage, detected by the DC-rejecting function.
Reads or sets the oscillator frequency (in Hertz) for the
If you use the stereo mode and two different oscillators:
circuit.osc.freq is for the LEFT audio channel,
circuit.osc.freq is for the RIGHT audio channel.
Example: VFO control for the "VLF radio",
Sampling rate calibrator.
- Frequency offset calibrator (or "drift detector")