# Spectrum Lab Configuration Dialog

From the Options menu you can activate a special Setup window, where you may modify the following parameters:

The 'Configuration and Display Control' panel is a tabbed window, which can be opened from SL's main window through the main window. For example, Options ... FFT Settings in the main menu will take you directly to the 'FFT' tab visible in the screenshow below.

The config window can optionally stay on top of other windows, even if it doesn't have the focus. To achieve this, click on the icon in the upper left corner to open a small popup menu, and check the item 'Stay on top'.
See also: Spectrum Lab's main index , user-defined menus , test circuitinstallation hints , troubleshooting ,  some applications .

### Transceiver Interface Settings

This item in the Setup dialog is used to define the COM port number where a "RX/TX" (=PTT) line and other control signals can be connected.

• PTT Control:
The hardware required to use this feature is exactly the same as for many PSK31-programs. For example, the RTS line of the serial interface can be set HIGH during transmit and LOW during receive. The signal actually used can be selected on this control panel. There are some interpreter commands to access this port, too. Alternatively (if there's no free COM port), consider using a pilot tone for PTT control.
• CW Keying:
Will be used to generate a slow CW keying signal.
This output can be driven by the Spectrum Alert function. A low signal means "no alert" (bell off), a high signal means "ALERT !" (bell should ring, warning light flashing etc).
• use SmallPort driver to access I/O ports
(removed, because either direct I/O port access or the "smallport" utility caused severe problems under Win XP, and most likely under any later version of windows)
• PTT pilot tone  (frequency)
Can be used for PTT switching through a weak pilot tone generated by the soundcard. This is an alternative to control a transmitter if your PC doesn't have a free COM port for this purpose. Whenever the transmitter shall be ON ("sending"), a pilot tone with the specified frequency is added to the output audio signal for the soundcard (approx. 20 dB below the max. output level, added to the signal at label "L5" in the circuit). Use a simple PLL tone decoder like the LM567 or similar to detect the pilot tone, and convert it into a switching signal. Note: The LM567 is marked as 'obsolete part' but it's still easy to find, cheap, and easy to use.
To disable the PTT pilot tone, set the frequency to zero (the default state). Beware to place the pilot tone outside of the transmitter's frequency range, but keep it below the half sampling rate: For example, use 5000 Hz is about the maximum if the soundcard runs at 11025 samples/second.

The group "Radio Control Port" can be used if Spectrum Lab shall be used to remotely control a suitable receiver (a "real radio"). Details can be found in the chapter "Interpreter commands for Remote Control". The parameters are:
• Serial port number
Note: At the moment, don't use the same port as for the PTT control (set the PTT control port to "none" if your PC only has one serial port)
• Bits/second
• Data bits
Set this parameter to "8" which works for 99% of all cases ;-)
• Parity
Set this parameter to "none" for ICOM's CI-V protocol
• Stopbits
Usually set to "1"
• Flow control
Set this to "none", because most radios use neither RTS/CTS (hardware flow control) nor XON/XOFF (software flow control)
• Protocol
Set this to "ICOM CI-V", or different (one fine day). The selection "none / ASCII-Text" means you can only send ASCII strings to the radio through an interpreter command, but there will not be any manufacturer-specific translation, message acknowledge etc.
This hexadecimal value (with "0x" prefix) must match the "CI-V Address" of the radio. You will find the default value in your radio's manual. Here are some values for ICOM radios (more at http://www.plicht.de/ekki/civ ) :
 Model IC-735 IC-751A IC-725 IC-706 IC-706MkII IC-706MkII-G IC-756 ... Address 0x04 0x1C 0x28 0x48 0x4E 0x58 0x50 ...

Note that for the "older" three HF radios, the frequency is sent with 8 digits only, while for all "newer" radios 10 digits are exchanged. So if you set the CI-V address of your IC-706 to 0x04 in its menu, SpecLab will think it's an old IC-735 and only send 8 digits (which fails if the frequency above 99 MHz). So better keep the radio's default settings, and select the right address in Spectrum Lab.

• Master Address (for CI-V protocol)
Usually set to 0xE0... at least this is what ICOM uses in their own examples.

## System Settings

Most of the 'system settings' are not saved in the normal user configuration file - instead, they are considered to be 'machine' but not 'application' dependent.
To modify them, select 'Options' ... 'System Settings' in Spectrum Lab's main menu. Most items listed below can be reached through submenus, or by picking one of the tabsheets on the configuration screen.

### Memory and spectrum file buffers

On the tabsheet shown below, you can define the number of spectrogram lines buffered in RAM (for scrolling back the spectrogram display), and the option to use a FILE instead of RAM for buffering the spectrogram data (i.e. Fourier-transformed blocks or 'spectra').

More details here.

### Audio Server Settings

Explained in another chapter .

### Timezone

Difference between local time MINUS UTC(GMT).
A few examples:

• enter "2" if you are in Germany, BeNeLux, France,  and windoze has adjusted your PC's clock for daylight saving time (MESZ)
• enter "1" if you are in Germany, ... , and windoze has adjusted your PC's clock for winter time (MEZ)
• enter "0" if you are in Great Britain, Portugal, etc; it's winter time or if you have convinced windoze not to fool around with your PC's clock in October
• enter "-5" if you are on the east coast of Canada or the USA (EST).

Alternatively, Spectrum Lab can ask the operating system for your timezone. If the 'timezone' information on your PC, including daylight saving time, is configured correctly, set the checkmark labelled
[ ] get time zone information from system .
With this setting, you don't need to care about the offset between UTC and your 'local' time (with or without daylight saving).

### Geographic Location

Enter your own location here, using the Maidenhead locator system, or by latitude / longitude lin degrees, minutes, and seconds .
This information will used in some exported files (for example, in wave files) if no GPS receiver is available. Used for radio direction finding.

### Timer Calibration

In this edit field, the precise frequency of a CPU-internal timer can be defined. This timer is used as a "high-resolution" timebase. Its frequeny is often 3.58 MHz, in some PCs only 1.79 MHz. The nominal value is queried automatically, but for some special applications you can enter the precise frequency here.

### Clock Source for timestamps:

Defines the clock source for timestamps (in spectra, waterfall time grid, and the "time"-function which is used in export data definitions). These options are avaliable:

• Use audio sampling clock only: Gives the best resolution and almost no 'jitter' because the time is calculated from the count of audio samples, plus an "offset" to get date+time. If you use a 'calibrated' sampling rate, or even an external A/D converter, this option is the best choice.
• Slowly pull towards PC's real-time clock: Provides a better long-term accuracy in some cases, especially if the audio sampling rate is drifting or not calibrated. With this option, the timestamps are always very close to the PC's real-time clock (usually one second or less).

(temporarily removed:)
Daily clock error :
The daily drift of your PC's "real time clock". Unit is seconds per day. Use the DCF77-decoder, a radio-controlled clock or the evening news on TV to find this value. Use this feature only if you really need it, and only if your PC runs in a thermally stable environment for a long time. If your PC's RTC is too slow, the value must be negative. The Reset button clears the number of accumulated 'compensation' seconds. Use this button after correcting the PC's clock from an external program. Internally, the program keeps a copy of the time when the clock error was zero.

### Filenames and Directories

Defines where certain files shall be saved. Beginning with Vista and Windows 7, you don't have the freedom to chose arbitrary directories (folders) because the Spectrum Lab installation directory, which is located somewhere in the 'Programs' folder, will only have read permission, including all its subdirectories. See the external document called 'Data Folders' for details about how the Spectrum Lab installer will deal with this problem.
To modify the currently active directories (within the data folders), select Options .. System Settings .. Filenames and Directories in SL's main menu. This opens the configuration window and switches to the tabsheet shown below.

(screenshot of the 'Filenames' tab)

Control elements on the 'Filenames' tab are:
• [ ] use relative path if possible, base: c:\Programme\Spectrum (just an example, depends on the windows version).
This option should always be checked. The base path cannot be modified here, in fact, it is the path for all 'data files' specified in data_file_paths.txt (a file which has been written by the installer). It cannot be modified by Spectrum Lab under certain windows variants because it's in the same folder as the executable, aka the "install directory", and all these folders only have read- but not write-permission under Vista & Co. If necessary, you can modifiy data_file_paths.txt with a text editor, but you will need an admin account (at least under Vista and Windows 7). More details about data folders with write permission are here .
• Machine Config: MCONFIG.INI
This is the default location for all machine-dependent settings for Spectum Lab, for example the soundcard sampling rate calibration table.
• User Config: SETTINGS.INI
This is the place where all settings of the current session are saved.
• Spectrum Ref (Spectrum reference):
A reference curve which can be displayed in the spectrum graph window. Details are here.
• Capture Image: Filename (base, without the index, and without extension) for the screen capture aka screenshot. Destination folder may vary, but "thanks" to Vista & Co, must be within the data folder (with write permission).
• Command File: File loaded into the command interpreter window during program start.
• Audio recorder: Path and file mask (with nnnn for the serial) for the internal audio recorder.
The meaning of the 'template' option is explained here (in the document about the triggered audio recorder). Basically, it the 'template' checkmark is set, certain characters in the filename will be replaced by date and/or time later (when recording starts), like:
YYYY = year (4 digits), MM = month (2 digits), DD = day (2 digits), hh = hour (2 digits), mm = minute (2 digits), ss = seconds (2 digits).
Three or more lower case 'n's will always be replaced with the file sequence number (regardless of the 'template' option).
• Radio Station List: Path and filename for the radio station list which can be displayed in the spectrum window.
By default, the installer places only a few sample files in the 'frequencies' folder within the data file directory. They can be modified with a text editor.

## Audio Settings

To open the audio settings dialog, select "Options"..."Audio Settings" from Spectrum Lab's main menu. Some of the parameters are explained here:

Audio Input Device, Audio Output Device:
Select which audio device ("soundcard") shall be used for input or output. These combo boxes contain all available soundcards, ASIO drivers, and more exotic devices which may be used as input or output for the digitized samples. In most cases, you will use these controls if your system really has more than one soundcard.
The audio device selection boxes may appear disabled if the audio stream comes from (or goes to) an external audio server. The audio server may be a simple interface program which reads analog samples from an external A/D converter, or one of the Audio I/O DLLs (explained in a later chapter).

(Screenshot of SL's audio settings tab, with different input devices)

Entries beginning with a number are standard multimedia drivers (not ASIO).

Entries beginning with an A: (but not a device number) are ASIO drivers. If an ASIO driver is selected as the INPUT device, the selection for the OUTPUT device is disabled, because in this case the same ASIO driver will be used for in- and output. ASIO provides a lower latency between in- and output, but is not available on all systems. Clicking the 'Ctrl' button will open the ASIO driver's channel selector.

Input devices  like "SDR-IQ / SDR-14" (-2) or PERSEUS (-3) require an extra hardware on the USB port, or a TCP/IP connection to a server running a USB/TCP-IP gateway. More info on using SpecLab with SDR-IQ is available in an extra document. If you want to use SL with PERSEUS, read this document .

In addition to the input devices listed above (standard soundcards, ASIO, and the two natively supported Software Defined Radios), you can add support for other 'special devices', if you have a suitable "driver" (interface DLL) for it. Details about selecting / "installing" such an interface are in another chapter. After installation, such drivers are either listed by their filename, or (depending on the type) by a short name after a prefix D: ("Driver").

For some of these devices, additional settings may be necessary. Use the 'Ctrl' button after selecting the type of the device. Depending on the device type, the 'Ctrl' button may open the standard soundcard volume control panel (for the selected WAVE audio device, but not under Windows 7), or a special SDR control panel (for SDR-IQ and Perseus), or a special control panel to select & or configure an audio I/O DLL, or open the control panel of a Winrad-compatible ExtIO-DLL.

To exchange uncompressed audio streams with other applications (for example, Winamp(tm) ), you can select also select the Audio-I/O-library (a special DLL) instead of the soundcard.
For absolute measurements, the input amplitudes must be calibrated. Amplitude display units like Volts or dBuV only make sense if the relationship between A/D converter value and absolute input voltage is known. Otherwise, stick to the default amplitude display unit which is "dBfs" (dB relative to full scale) .

Other sources, other destinations :
These links take you to another tab of the configuration dialog, where alternative sources and destinations for digitized audio (or quadrature IF streams) can be configured. This includes audio servers and -clients, which can be connected through different ways (TCP/IP, WM_COPYDATA messages, periodically written audio files, etc). The WM_COPYDATA method was, for example, used to receive data from the "winamp-to-SpecLab" plugin, which is described here.
If the "local" soundcard is used for in- and possibly output, you don't need to care about these other sources and destinations.
Sampling Rate:
The nominal audio sample rate of the soundcard, which is the number of samples per second read from the analog/digital converter.
Both sound-input and -output use the same sampling rate (dictated by hardware). You should use the lowest possible sample rate allowed by Shannon's theorem: With 8000 samples per second, you can process signals up to 4000 Hz. Don't use higher sample rates just because your soundcard supports them ! Only for very special applications (like the "VLF radio"), sample rates up to 192 kHz may be necessary. SpecLab works with sampling rates up to 192kHz, but only a few cards really support such high sampling rates. Caution, the windows multimedia driver will happily deliver any sampling rate - even if the hardware doesn't support it (it will be interpolated then, which is not really helpful).
Some cards can play dirty tricks when you use 48000 samples per second (because they don't support 48000 sampling), which leads to "phantom signals" on the waterfall. See the notes in the "VLF Radio" application.
Some other cards play dirty tricks when running in full duplex (which means input + output running at the same time): For example, the input- and the output sampling rate may be slightly different. More details  in the chapter about output resampling. (use a different output sample rate; any ratio between 0.5 and 2.0 is possible).
Other stupid soundcards don't support 44100 Hz (which is surprising because that's the Audio CD standard).

If you are running Windows 7 (and most likely any later windows version), and want to use the soundcard at 48 kSamples/second and more, don't miss this note (defeat anti-aliasing through the windows system control), and this important note about selecting the soundcard's sampling rate in the umpteenth little-known and hard-to-find configuration screen of Windows 7 !

Also don't miss the sampling rate calibration if you use the program for the first time, or have installed a new soundcard.
If a soundcard really supports a certain sampling rate (like 48000 Hz / x or 44100 Hz /x) is not always easy to tell, because if the sampling rate 'requested' by the application is not really supported by the hardware, the driver software (or the windows multimedia system) jumps in, and tries to interpolate / extrapolate to realize the sampling rate by software. Unfortunately, Windows does a really bad job on some machines. For example, on one of the author's PCs (a Lenovo Z61m), when trying to run the onboard audio device at 12000 samples/second, the signal sounded 'distorted', and the CPU load caused by the 'SYSTEM' process (indicated in the Windows Task manager) went up to 5 Percent, as long as the audio input was running. Switching back to 11025 samples/second cured this problem, the audio sounded 'clean' again, and the CPU load caused by the 'SYSTEM' process went back to zero.
Again, it's not easy to tell which sampling rates are really supported, so if you find strange effects / poor audio quality / dropouts / unexplainably high CPU load, try a different sampling rate - first try a fraction or multiple of 48000 Hz (like 12000, 16000, 32000, 480000, 96000). If that doesn't work well enough, try a fraction or multiple of 44100 Hz (like 11024, 22050, or 44100), especially on 'old' machines because sampling rates of 44100/N were the standard in the age of Soundblaster and Co.
Last not least, it's possible to compensate the sample rate drift continuously, for example for phase measurements or high-accurary frequency measurements.

Sampling Rate Divisor:
Defines the decimation ratio between the analog/digital conversion rate and the processing rate of all following stages (which you can see in the component window, for example frequency converter, digital filter, but also the Spectrum Analyzer).
Reducing the sample rate at this early stage is especially helpful if you run out of CPU power, because -depending on what you are doing- the real-time sound processing threadwhats_a_thread can 'eat up' a lot of the available CPU time. The internal processing rate is:

<Sampling Rate> divided by <Sample Rate Divisor>, for example:

11025 samples per second, divisor set to "2" will give an internal processing rate of 5512.5 samples per second. This would be enough to process audio signals below 2kHz (theoretically 2756 Hz, but this is impossible because of the anti-alias-filter's roll-off).
Note: After this decimation stage, and before the FFT calculation, there may be more decimation stages. See 'FFT Settings'.
Bits per sample
Defines the resolution of the A/D converter. Usually 16 bits per sample. A few cards also support 24 bits per sample, resulting in more dynamic range (only required in rare cases though). Has only been tested -with positive result- with the Soundblaster Audigy 2 ZS, but the difference between 16 and 24 bit per sample can only bee seen if the input signal is *very* weak. With most 'real-world signals' you won't see a difference in the spectrum, unless you have the ultimately pure sine wave generator on your workbench. The theoretic dynamic range with 24 bits is somewhere near 20*log(2^24) = 144 dB, more realistic are 108 dB as specified for the Audigy 2 card.
For most applications, stick to a resolution of 16 bits per sample.
Use anti-alias filter
has no effect at the moment, because the anti-alias filter is always enabled if the Input Sample Rate Divisor is set to 2 or higher.
The anti-alias filter's length may be adjustable in future releases.
Switches to a submenu of the circuit window, where the gain balance and phase errors from an image-cancelling direct conversion receiver can be compensated. More details can be found in a separate document (if you don't know what a direct conversion receiver is, you don't need it anyway.. )
Sample Rate Calibration Table
Because the true sample rates used by some soundcards (also expensive ones!) differs significantly from the 'nominal' value, you can enter the true values for a number of standard 'nominal' rates in this table. The "one-time" sampling rate calibration procedure is explained in another file. For normal audio applications, you don't need this.
In rare cases (depending on the soundcard), the conversion rate of the ADC and the DAC can be different. Since Version 2.7, Spectrum Lab contains a resampling function which can cope with this problem, but it requires some additional CPU power (see the notes about soundcards with slightly different sampling rates in the next chapter).
If you are looking for extreme frequency accuracy, it is possible to continuously 'detect' or 'calibrate' the sample rate but you need a stable reference signal).
Some soundcard oscillator drift tests can be found here .

Note: Besides these settings, be prepared to spend a few hours playing with your soundcard's own "volume control panel" (or whatever the manufacturer called it), until you managed that the audio input (from the "line-in" jack) only(!!) goes into the A/D converter, and the card's audio output (the "line-out" jack) is only fed from the D/A converter, without annoying bypass. Read more about this in the document about SL's installation.

### Adding a special driver for other audio input devices

Certain interface DLLs (Dynamic Link Libraries) can be added to the list of input devices (see previous chapter). Click the "..."-button next to the input device combo (with soundcards, ASIO devices, certain SDRs, etc).

The principle to "install" such a "driver" (actually, just select the driver's interface DLL for input) is described here. The same method is used for Audio-I/O-DLLs and for Winrad-compatible ExtIO-DLLs. Note: No other kind of DLL (besides ExtIO and Audio-I/O-compatible DLLs) can be "installed" this way.

After installation, such drivers are either listed with their complete path and filename (typically beginning with drive name C:/) , or -depending on the type- with a short name after a prefix D:  ("Driver DLL"). Note that file paths never have a space after the drive name, which distinguishes them from ASIO drivers (prefix "A: "  - note the space after the colon) and the short name of a Driver DLL (prefix "D: ").

The 'Audio I/O Libraries' (see next chapter) are just ONE example of such a 'special driver'. There may be other, hardware-specific drivers (or at least interface-DLLs to the real driver) which can be installed in a similar fashion.

### The Audio I/O Libraries

( 2011-08-14:  This function has been re-written, the new DLL is incompatible with older audio-I/O libs ! Older libs didn't support timestamped streams.
Details are in the Manual for the Audio I/O libraries (PDF available on-line, not contained in the spectrum lab installer. )

To exchange uncompressed audio streams with other applications, you can select select the Audio-I/O-library (which is a special DLL) instead of the soundcard. For 'normal' applications which only use a soundcard for input and/or output, the rest of this chapter will not be worth reading for you... so skip this chapter if you intend to use SL with a soundcard.
Originally, the Audio I/O library (in the form of in_Audio.dll) was intended as an "audio output" from Spectrum Lab's point of view, and as an "audio input" for Winamp(tm), for the sole purpose of streaming audio from Spectrum Lab via Winamp. Details about in_AudioIO.dll and winamp at the end of this chapter.
Since then, the audio I/O library (at least in_AudioIO.dll) has turned from a simple 'input plugin' for Winamp into a general-purpose 'audio bridge' for various applications. For example, it can also be used to connect two (or more) instances of Spectrum Lab, with pre-processed data passed from one instance of the program to another.
To 'install' an audio I/O library as an input device, add it to the list of devices as explained under 'Adding a special driver for other audio input devices'. Then, select the DLL as the new 'Audio Input Device' on the Audio Settings tab as in the example below:

Depending on the DLL, additional settings may be necessary. To do this, click on the "Ctrl"-button in the 'Audio Input Device' panel (see the small screenshot above). This opens a new control panel, in which you can select the directory paths and stream identifiers (more on that later):

Since August 2012, Spectrum Lab supports I2PHD's Winrad-compatible 'ExtIO'-DLLs besides its own Audio-I/O-DLLs. The concepts are similar, and the DLL-host implemented in Spectrum Lab will automatically detect which kind of DLL is selected for input.
If only a filename without a path to the audio-I/O-DLL is specified, Spectrum Lab will try load the library from the following places, in the sequence specified below. However it's highly recommended to specify a full path, because with each new major version of windows, we are urged to install programs (and/or their plugins) in different folders !

1. C:\Program Files\Winamp\Plugins\in_AudioIO.dll (*)
2. C:\Programe\Winamp\Plugins\in_AudioIO.dll  (default path for a 'German PC')
3. C:\Programmi\Winamp\Plugins\in_AudioIO.dll  (default path for an 'Italian PC')
4. in_AudioIO.dll in the "current working directory" (CWD) ,whatever that is...
(the concept of the 'current working directory', as implemented in windows, is quite broken because the file selector box (a windows dialog) modifies it by its own gusto, even when told by the application not to do so, so don't rely on it. Spectrum Lab tries to set to set the CWD back to where it should be after opening a file selector, but this isn't bullet-proof. Select the DLL manually in this case, and make sure you pick the correct, and full path ! )

(*) If the Audio I/O Library is used as a gateway between Spectrum Lab and winamp, it MUST be loaded from winamp's "Plugins" directory. Most applications (like streaming to the internet) don't require Winamp anymore; and in that case you can install the DLL in other folders.

Don't be confused by the name "in_AudioIO.dll" - the prefix "in_" must be seen from Winamp's point of view : For winamp, it's an input plugin. For Spectrum Lab, it's an output device, but it can also be used as a link between an audio-producer and an audio-consumer. Thus "in_AudioIO.dll" can be used either as an audio input, or an output, but not both at the same time in one program instance.

Optionally, you can specify a unique 'Stream ID' in the Audio-I/O-selection dialog. This is necessary if there are multiple instances of  the 'Audio-I/O-DLL' running on your PC at the same time. For example, there may be one program providing a stream named "VLF", and another (or the same) program providing a different stream named "VLF_2". If both using the same Audio-I/O DLL for distribution, you must fill out the 'Stream ID' field to connect to the wanted channel.
Any further configuration of the audio I/O library is beyond Spectrum Lab's control. As shown in the screenshot of the 'Audio I/O-DLL Selection for Spectrum Lab' above, there is a button with the 'hand pointing right' : It usually opens a special configuration screen in the DLL (if the DLL supports it). The sample DLL ("in_AudioIO.dll") which is contained in SpectrumLab's installer will show something like this:

Hint:
If an audio-IO-DLL is already selected as the 'input' in Spectrum Lab, you can open the DLL's control panel through SL's main menu:
Options ... Show Control Panel for audio-input-DLL. The same applies to Audio-I/O and ExtIO.

There may be other 'Audio-I/O-DLLs' available - for example, DLLs used as drivers for 'exotic hardware'. The above screenshot is just an example for such a DLL. Actually, "in_AudioIO.dll" can be used to distribute a gapless, uncompressed audio stream from one source to multiple destinations ("readers"), which are listed on the DLL's control panel. Winamp may be one of those destinations (from Winamp's point of view, this DLL is an "input plugin"). The control panels of other I/O-DLLs may look completely different, and it's unlikely that they will also operate as Winamp input plugins.
Again, details about the Audio-I/O-DLLs are available online (as PDF) in the Manual for the Audio I/O libraries.

See also:  Audio streaming, SL Audio Settings, Sending audio from SL to Winamp, Winamp Plugins, Details about Audio I/O DLLs (web link), Overview (index).

#### Using in_AudioIO.dll to stream audio into Winamp

Originally, the Audio I/O library (in the form of in_AudioIO.dll) was intended as an "audio output" from Spectrum Lab's point of view, and as an "audio input" for Winamp(tm), for the sole purpose of streaming audio from Spectrum Lab (acually a filtered VLF Natural Radio stream) via Winamp, and the Oddcast plugin, to an internet audio server (Icecast). Details about that are beyond the scope of the Spectrum Lab help system; you can find more info about using the Audio-I/O-library to connect Spectrum Lab to Winamp here (external weblink, requires an internet connection, and describes the configuration of Spectrum Lab, Winamp, Oddcast, and Icecast. Unfortunately, the development of Oddcast or "Edcast" seems to have stopped.... see http://www.oddsock.org/ ).
For audio streaming applications, consider using Ogg/Vorbis instead of in_AudioIO.dll . Support for outbound Ogg/Vorbis audio streams is integrated in Spectrum Lab; MP3 is not .

#### Using in_AudioIO.dll to stream audio from one SL instance to another

For this application, it's not necessary to copy the in_AudioIO.dll into the winamp plugin folder, but recommended. If you don't have winamp installed on your system, unpack in_AudioIO.dll into the spectrum lab folder. This way, SL will find it automatically even if you didn't specify a full path.
The library 'in_AudioIO.dll' can be used to feed digitized audio from one writer (source) to multiple readers (destinations). Example:

1. The first instance (of Spectrum Lab) reads samples from the soundcard, resamples them to the precise nominal sampling rate (using the SR calibrator) and sends the processed samples to the audio-I/O DLL. For this purpose, the configuration of the 1st instance has the 'Audio Input Device' set to the soundcard (-1 = default wave input), and the 'Audio Output Device' is an 'Audio I/O DLL' .
2. The second instance (of Spectrum Lab) has the 'Audio Input Device' set to the same 'Audio I/O DLL' (same path, same file).
3. The third, and any other instance (of Spectrum Lab) have their 'Audio Input Devices' also set to the same 'Audio I/O DLL' .  Thus the same signal (produced by the 1st instance) can be processed by multiple other instances of Spectrum Lab, without the need for a 'virtual audio cable' or multiple soundcards connected to each other.
This is possible because the audio I/O libraries (at least "in_AudioIO.dll") support multiple readers.
4. The same DLL (in the same folder) can also be loaded by other applications at the same time, besides Spectrum Lab. This is possible because the DLL uses shared memory to distribute the digitized audio stream. Details on how to use the audio I/O DLL in your own application are here (external link).

See also:  Audio streaming, SL Audio Settings, Sending audio from SL to Winamp, Winamp Plugins, Details about Audio I/O DLLs (web link), Overview (index).

### Using a Winrad-compatible ExtIO-DLL for input

Since August 2012, Spectrum Lab supports I2PHD's Winrad-compatible 'ExtIO'-DLLs besides its own Audio-I/O-DLLs. The concepts are similar, but the API is very incompatible. Fortunately the DLL-host implemented in Spectrum Lab will automatically detect which kind of DLL is selected for input. You may find an ExtIO-DLL for 'your' radio at winrad.org/. For SDR-IQ and Perseus, this is not required because these two radios are supported natively by Spectrum Lab.

To 'install' an ExtIO-DLL ("driver") for input in Spectrum Lab, select "Options" .. "Audio Settings" in SL's main menu.
Then, click on the three-dotted button to select a driver for the new input device:

Next, select the 'driver' (actually just an interface DLL). This may be an ExtIO-DLL (filename begins with "ExtIO" and ends with ".DLL", which you only see if you reconfigured the STUPID windows environment so it doesn't hide known extensions by default). Note that for some/many/all ExtIO-DLLs it may be necessary to install them into the same directory where the application is installed (in this case, SpecLab.exe). Reason: Some DLLs don't find certain auxiliary files when the 'current directory' is not the same as 'their own' directory. This is stupid, but that's the way things are.
Here, for example, the ExtIO-DLL to control PERSEUS:

After that, Spectrum Lab prompts you for additional parameters which may be passed to the DLL on initialisation. The ExtIO-DLLs don't support command line arguments, so in most cases you can leave the 'parameters' field empty:

Only if the ExtIO-DLL doesn't provide the digitized samples itself, but relies on the soundcard for input, the name of that soundcard must be entered in the 'parameters' field shown above. In certain cases, SL can make an 'educated guess' for the name of the soundcard. For example, the FiFi-SDR identifies itself as 'FiFiSDR Soundcard' to the windows multimedia system, thus after selecing 'ExtIO_Si570.dll' as the new input device, Spectrum Lab will preset the 'parameters'-field with the string 'FiFiSDR Soundcard'; but it's your decision to modify this box as necessary.
Spectrum Lab will add the complete path to the DLL in its list of "input devices" now, so you can easily select it (or any other device) quickly by picking it from the list. There is also a button ("Hand pointing right") on SL's audio input panel (see screenshot) which may take you to a hardware-specific control panel.

#### FiFi SDR

The FiFi-SDR is a small software defined radio with an integrated USB soundcard. It contains a programmable VFO, using the Si570 (programmable oscillator chip). As an (almost) fully assembled kit, including the preselector board, the SDR was available for 130 Euros in 2012 at the german Funkamateur Verlag:

To control this cigarette-box sized HF receiver from Spectrum Lab, you will need a special ExtIO by Fred, PE0FKP, filename 'ExtIO_Si570.dll'.
Do a web search for 'SoftRock Ensemble Configuration Tool'. The installer for Fred's 'driver DLL' used to be at pe0fko.nl/CFGSR/, along with a nice tutorial. Note that the FiFi-SDR is only one of a couple of Si570-based radios supported by this DLL.
A similar ExtIO-compatible interface for the FiFi-SDR may work, too; but none (besides Fred's) was completely tested by the author of Spectrum Lab.
An alternative DLL named 'ExtIO_FiFi' was found somewhere, which seemed to work for a while, but it always crashed when trying to open the control panel (ExtIO: "ShowGUI"). The DLL was dumped for that reason.
Details about the FiFi-SDR, developed by German radio amateurs (on their 'FichtenFieldDay', thus the name) used to be at o28.sischa.net/fifisdr/trac and www.ov-lennestadt.de/.
Unfortunately, the FiFi-SDR hardware seems to be better than the control software. On the author's PC, controlling the VFO frequency (through ExtIO_Si570.dll) often stalled. If 'your' FiFi-SDR also doesn't react on changes in the VFO frequency, don't make the same mistake by changing the settings on the ExtIO_Si570 control panel ! Instead, unplug and re-plug the USB connection. In most (if not all) cases, the VFO worked properly again afterwards.
Here are the settings used for the FiFi-SDR, on the ExtIO_Si570 control panel:

The preselector settings on the ExtIO_Si570 don't seem to have any effect for the FiFi-SDR: After soldering 8 additional LEDs to the preselector board to indicate the preselector switches, it became obvious that the microcontroller drives the preselector switches automatically.
Another note about the FiFi-SDR: On a PC running trusty old Windows XP, the FiFi-SDR's soundcard delivered 96 kSamples/second, and the observable bandwidth was 96 kHz (but with severe aliasing effects at the extreme edges).
On a PC with Windows 7, 32 bit, "Home Premium", the very same device, same soundcard, only showed a 48 kHz wide band even when the sampling rate (configured in SL's 'Audio Settings' panel) was also set to 96000.
How to cure this annoyance is shown below; if you have an EASIER way to get the FiFi-SDR running at a 'true' sampling rate of 96000 Samples/second under Windows 7, please let me know. Here's what the author tried on a german Windows 7 machine:
1. Open the system control ("Systemsteuerung"), switch the display from "Kategorie" ('Category' ?) to "Kleine Symbole" ('Small Icons' ?). On a german PC, this window was titled "Alle Steuerungselemente", if that means anything to you.
2. Click on the 'Sound' icon (loudspeaker symbol) .
3. Switch to the tabsheet "Aufname" ('Recording' ?)
4. With a bit of luck, you will find a 'Microphone' there, followed by the name 'FiFiSDR Soundcard' (stupid, isn't it ?).
Click on that device to select it for the changes below.
5. Click on the button labelled "Eigenschaften" ('Properties' ?). Do not click on "Konfigurieren" ('Configure' ?).
With even more luck than you already had, this button opens yet another well-hidden propery panel.
6. On the german PC, the control panel had the stupid title "Eigenschaften von Mikrofon" ('Properties of Microphone' ?)
(Microsoft seems to think that every audio source connected to a soundcard's is a 'microphone', but you can change the text from 'Mikrofon' to something like 'SDR', and pick another symbol for the device)
7. On the tabsheet 'Erweitert', 'Standardformat', 'Wählen Sie die Abtastrate und die Bittiefe aus'...
(Something like 'Extended' (?), 'Standard format' (?), 'Select sampling rate and bits per sample' (?) )
8. Switch from '2 Kanal, 16 Bit, 48000 Hz (DVD Qualität)
to '2 Kanal, 16 Bit, 96000 Hz (Studioqualität)' .
After the above steps, the FiFi-SDR showed the full 96 kHz wide in Spectrum Lab, also on a Windows 7 machine.
Fred's ExtIO_Si570.dll was manually installed into C:\afusoft\FiFi-SDR\ExtIO_Si570.dll . This full path must be added to Spectrum Lab's list of audio devices (under 'Options'..'Audio Settings', click on the three-dotted button to select the file). After that, SL's Audio I/O configuration tab should look like this:

Note: Unlike noted elsewhere, the ExtIO-DLL doesn't need to be copied into the Spectrum Lab folder. With a full path specified as in the above screenshot, SL will load the DLL, and if the DLL itself is smart enough, it will be able to load other files (if needed) from its own installation folder.
With the ExtIO_Si570 loaded, Spectrum Lab will look for a name like 'FiFiSDR Soundcard' in the list of 'audio devices' offered by the windows multimedia API. If that doesn't work (because on your PC the 'FiFiSDR Soundcard' has a different name), declare the FiFiSDR Soundcard as the 'default audio input device' for windows. That way, if SL doesn't find a device which looks like a FiFiSDR (soundcard), it will use the default WAVE input (device "-1").
This is necessary because unlike most other 'ExtIO'-DLLs, ExtIO_Si570 doesn't deliver the digitized I/Q samples from the radio. ExtIO_Si570 only controls the radio's VFO (it doesn't even control the nice bandpass filters aka "Preselector Board" in the FiFiSDR, at least not in ExtIO_Si570 V2.6 which was the version used for these tests).

### Output resampling

In certain cases, the sampling rate of the audio output (DAC) may be different from the sampling rate of the input (ADC).
Example:

• The input comes from an external "box" (for example, an SDR), which uses an exotic sampling rate that is not an integer multiple of your computer's soundcard,
• your computer's soundcard uses slightly different sample rates for the in- and the output (this happened, for example, with the integrated audio device in Thinkpad notebook). How to notice this is explained further below.
• you want to connect an exotic audio output device to the computer, which doesn't use one of the 'standard' audio sampling rates

In these cases, open the "Audio I/O" tab in SpecLab's configuration dialog. Set the checkmark "use different output sample rate", and enter the nominal sampling rate. For example:

 [v] use different output sample rate:    nominal : 22050 Hz


SL will try to lookup the precise sample rate in the sample rate calibration table.
The "precise" sampling rate for the output may be a bit difficult to find out if you don't have a hardware frequency counter, but there is a trick how to do this below. SpectrumLab needs to know this "real" output sampling rate to calculate the precise resampling ratio, which may be any fractional number (thanks to an algorithm similar to those explained at http://www-ccrma.stanford.edu/~jos/resample/ ). The next chapter describes on of the most important applications of the output resampling function.

### Bad soundcards with "slightly different" sample rates for ADC and DAC

A quick check to see if the input- and output sampling rate of your soundcard are exactly equal (as they should, in a 'good' soundcard) :

• Turn the option "use different output sample rate" off (see above)
• Turn on both ADC and DAC in the circuit window (so the soundcard runs in full duplex mode)
• Turn on one of the sine waves in the test signal generator, and connect it to the output
• Let the generator run for several minutes, and listen to the tone. If you hear a clean note without any gaps (popping or clicking sounds), you don't need different input- and output sample rates !

Otherwise, in the main menu, select "View/Windows"..."Debugging Window". On the Debug tab, there are indicators for the input- and the output buffer usages. Watch the display for "OutBuf=XX %" and "InBuff=XX %". Typically (if all works well in full duplex mode), the output buffer is filled to 40 .. 60 percent, and the input buffer is filled to 0 percent. Why ? As soon as input samples are received from the soundcard, they are processed; so the input buffer is ideally empty most of the time. On the other hand, the output buffer must not run empty - otherwise, there is the chance of interrupted audio output (which you hear as "popping" or "clicking" sounds). When the audio processing starts, the output buffer is filled to about 50 percent of the available space.
If the "OutBuff" percentage slowly decreases, the true output sampling rate is higher than the nominal value (as in the example shown above).
If the "OutBuff" percentage slowly increases (or the "InBuf"-percentage increases), the true output sampling rate is smaller than the nominal value.
If you have a frequency counter, you can easily find the correct value for the true ("real") output sample rate: Use SL's test signal generator to produce a 1000 Hz tone, measure it with a frequency counter, and calculate the "real" sample rate as below:
f_sample_real = f_sample_nominal * f_test_measured / f_test   .
Example: f_sample_nominal = 22050 Hz, f_test = 1000 Hz, f_test_measured = 1006.8 Hz
-> f_sample_real = 22050 Hz * 1006.8 / 1000 = 22199.94 Hz  .
After this, there should be no more input buffer overruns, or output buffer underruns... until you install another soundcard !

### Multiple soundcards in one system

If you have more than one audio device (soundcards eg) in your system, you can select the audio input and output which shall be used by Spectrum Lab in the audio settings.

Beware: The names which appear in the selection list are sometimes quite cryptic, like "Nr. 3 = Hochwertiges Bluetooth-Audio" on the author's machine.
If there's only soundcard installed on the PC, leave both "Audio Input Device" and "Audio Output Device" set to the default value (-1 = default WAVE input / output). The program will then use the first available soundcard, which is usually correct.
Entries in the device selection lists which do not begin with a number are ASIO drivers. More information on how to use ASIO is in this separate document .

### Unexpected aliasing, and notes about soundcard settings under Windows 7

#### Unexpected aliasing under Windows 7 (depending on the sampling rate)

The following was suggested by a member of the Spectrum Lab user's group (- thanks Ed -) to eliminate aliasing effects when trying to run the soundcard at 48000 samples/second or more under Windows 7 :

• Look into the sample-rate setting under the 'Advanced' setup in the properties of the sound recording device.
(Control Panel > Sound > Recording tab, highlight your device and click Properties, then the Advanced tab).
• You may find that W7 is setting your card up at the default 44.1, and everything else is resampled.
I see this with my Gigabyte onboard Realtek 889, W7 32-bit.
Tell W7 to use 48k and all will be well.

So, even though the audio hardware supported 48000 samples per second, and the application (Spectrum Lab) requested 48000 samples per second from the "operating system", Windows 7 stupidly resampled from 44100 to 48000 samples/second, causing signals above 22050 Hz to "fold back" at the Nyquist frequency (= half sampling rate).
Most likely, the same also applies to higher sampling rates (96 or even 192 k, if the audio hardware supports it).

#### Trouble with Windows 7 / missing 'Wave Out Mix' in the source selection

In the soundcard Mixer Control of Windows 7, input controls like "Master record" and "Wave Mix " seem to be missing. It seems to be impossible to select "what you hear" for input.
If you also miss these important 'mixer controls' under Windows 7, here's where to find them (thanks Chris for answering the question in the Spectrum Lab User's group !) :
> If the 'Wave Out Mix' is hidden and not made obvious at all, try this:

1. Select sound from the control panel.
2. Select the recording tab.
3. Right click on the background of the tab and choose "show disabled devices."
4. Right click on Wave Out Mix and click enable.
5. Now it should work the same way as Wave Out Mix in Windows XP, allowing you to record any sound your computer makes.

In other cases (reported in the Spectrum Lab User group at yahoo), input devices did not appear in Spectrum Lab's list of audio input devices, as long as nothing was plugged into the 3.5mm audio jack !
Connecting a dummy plug into the PC's 'line input' made the device appear in the stupid list of audio devices reported by windows.

#### Selecting higher sampling rates under Windows 7

On some machines (running Windows 7), it required some additional work to get the soundcard running at the 'desired' sample. It's a mystery why windows doesn't automatically switch the soundcard to say 96 kHz when the application (here: Spectrum Lab) 'asks' for it; especially when no other program uses the card. But there you are.. windows cannot be explained by logic.
Here's how the author got an onboard audio devive running at 96 kSamples/second, or even more. In this case, a Lenovo X61s also supported 192 kSamples/second:
First, open the 'Sound' control panel, and switch to the 'Recording' tab ('Aufnahme' in German)...

(depending on window's mood, this screen can be opened through Spectrum Lab's
main menu : Options ... Volume Control for Record (audio in) ... at least in Windows 7)

On that tab, click on 'Properties' (not 'Configure') - in German, 'Eigenschaften', nicht 'Konfigurieren' !).
This opens yet another dialog window, titled 'Eigenschaften von Mikrofon' / 'Properties of Microphone' (?).
Switch to 'Erweitert' ('Extended'?) on that tab. If you're lucky, there is combo box which can be expanded into a long list of different 'qualities', with different bit depths and sampling rates:

Be sure to pick the same sampling rate as you did in Spectrum Lab's audio settings tab !

## Audio File Servers and Clients

It is possible to connect Spectrum Lab to an other application which serves as "remote Analog/Digital converter" or "Digital/Analog coverter". The other application then acts as "Audio File Server" to replace the audio input (ADC) and/or output (DAC). This may be used as an interface to any kind of exotic audio hardware. (Note: You don't need this if SL shall analyze the audio input from your "local" soundcard !)
To establish a link between an audio client and an audio server, the audio client (which is Spectrum Lab) must know the name of the audio server, or at least the name of the file produced or consumed by the server. All this can be configured in Spectrum Lab's "Audio File Server" menu:

For example the program may receive audio data from an audio server called "SndInput.exe" and sends sound data to "SndOutpt.exe". (These are just examples, I use these two programs myself. Instead of SndInput.exe use SerInput.exe if you have an external A/D converter on the serial port. See notes below)
In this case, simple disk files are used to exchange audio data from "producer" to "consumer". The audio file transfer protocol is very simple (not "FTP" for heaven's sake :-), it is described in a file which is available from the author of Spectrum Lab (part of the sound utility package, files "SoundUtilityInfo_01.txt" (english) and "SoundUtilityInfo_49.txt" (german). Two sample programs which use the soundcard are written in plain "C", and are available on the DL4YHF website. They can easily be adapted to drive any external A/D or D/A hardware. To drive the author's PIC-based A/D converter (connected to the serial port), use the serial input utility mentioned further below.
To use an external A/D or D/A "server" program, fill out these fields in Spectrum Lab's setup dialog:

Activate this checkmark if you want to use an external audio file server instead of your soundcard's analog/digital converter,
and enter the name of the file which will be produced by the audio server.
Example: ..\SoundUtl\audio.dat
"to start A/D server"
This is an optional service if you want to start your A/D server automatically from SpecLab (only possible when the audio server runs on the same PC as SpecLab, otherwise you will have to start the server manually). Example:
Example: C:\SoundUtl\SndInput.exe /of=audio.dat /sr=11025 /ch=1 /dt=1
(Look into the A/D server's manual for the necessary command line parameters ! The command line may be added automatically after you selected the server by clicking on the [...] button )
"to stop A/D server"
This is a similar command line as the one above, but to stop the A/D file server (and terminate itself, usually..). The command line argument for both SndInput.exe and SerInput.exe is /quit .
"produce DAC file"
Activate this checkmark if you want to use an external audio file server instead of your soundcard's analog/digital converter,
and enter the name of the file which will be produced by the audio server.
Example: ..\SoundUtl\to_dac.dat
"to start D/A server"
Works like "to start A/D server" (described above) if you want to start the D/A-conversion server automatically from SpecLab.

Besides web streams and the "file-based" audio interface, it is possible to send and receive uncompressed audio through other means:

Notes:

• While the "A/D" server is in use, the message "File doesn't exist" may appear on the tabsheet "A/D D/A Server". This is not an error. It only means that SpecLab looked for the audio exchange file and didn't find it, because the server has not produced a new file since SL last deleted it. Under normal conditions, the message toggles between "no error" and "file not found". If the "file not found"-message never disappears, make sure the filenames are correct, and the A/D server writes the file into the directory where SL expects it. It may be helpful to specify the full path for the audio file, not just the pure filename (something like "c:\temp\audio.dat" instead of just "audio.dat").
• SL uses 16-bit integer values (by default) to communicate with "audio file servers". This may be different if decimated I/Q sample pairs are used.
• For more information about the "sound input" and "sound output" utilities, look into the file ?..\..\SoundUtl\SoundUtilityInfo_49.txt (in german) or ?..\..\SoundUtl\SoundUtilityInfo_01.txt after downloading and unpacking the "sound/audio utilities" from DL4YHF's website. If you already have a copy of DL4YHF's "Sound Utilities" on your harddisk: The SoundUtilityInfo-links only work if you have downloaded these utilities and copied them into the same directory structure as in my original "source files".

### PIC-based A/D converter for the serial port

Since October 2002, a firmware is available for a PIC12F675 microcontroller which can be used as an external A/D converter for 2 channels at exactly 2500 samples per second. Data are sent to the PC through the serial port ("COM1" or "COM2"). PIC-Firmware and "interface driver" program ("SerInput.exe") can be obtained from the author, or downloaded from DL4YHF's homepage. The "interface driver" program is implemented as an audio server for Spectrum Lab (and almost any other application, written in any programming language which can access simple disk files). See hardware desription for the PIC-based serial A/D converter for more details.

### Sending and receiving audio through WM_COPYDATA messages

Different audio-processing programs running on the same computer can send audio in real-time to other applications without the need for an extra soundcard, or a virtual audio cable. Spectrum Lab (and a few other applications written by its author) can use WM_COPYDATA messages. Details about the principle are here. One application which uses this feature is an output-plugin for Winamp, which allows you to play MP3 files (and audio streams received from the internet) directly into Spectrum Lab. Details about the Winamp-to-SpecLab plugin are here.

### The Winamp-to-SpecLab output plugin

Since it is rarely used, this plugin is not part of the Spectrum Lab installer. Instead, you can download it from here - or, if the page has moved because I changed my ISP, search for "WINAMP -> Spectrum Lab output plugin". That page also described the installation of the plugin (which means to unpack it, and copying the DLL into Winamp's plugin folder).
It is an "output" plugin from Winamp's point of view. From Spectrum Lab's point of view, it is an audio source like many others. SpecLab doesn't need to know that this particular plugin sends the audio data. All you need to do within SpecLab is set the option Receive audio data through WM_COPYDATA messages in one of the configuration tabs.
Some technical details about the communication between this (older) winamp plugin and Spectrum Lab are explained here.

### Sending audio from SpecLab to Winamp

The other direction (from Spectrum Lab to Winamp) is also possible, i.e. send audio from SpecLab to Winamp. To do this, you will need another plugin (an "input plugin" from Winamp's point of view) which can be found here (external link, not part of SL's online help system). If the link is broken, search the web for "DL4YHF Audio I/O libraries". You will also find the sourcecodes, and a manual (PDF) for the audio I/O libraries there.
In fact, the "SpecLab to Winamp" plugin (filename "in_AudioIO.dll") is a specialized audio-I/O-DLL written for Spectrum Lab by its author. Note that unlike most other Audio-I/O-DLLs, it must be placed in Winamp's plugin directory, and must not be copied anywhere else, to work properly. This restriction doesn't apply to any other audio-I/O-DLL.

... turned into a nightmare, and was only possible with "ancient" plugins from Winamp Version 2.9 (and older). The full story is here. It may still be working, but most of the plan was abandoned in 2008 .

## FFT settings

The FFT settings are on one tab of the Configuration and Display Control dialog. It can be opened from the menu "Options ... FFT Settings". The following parameters can be adjusted :

Decimate FFT Input (formerly: Sample Rate Divisor)
An internal "sample rate divisor". This parameter is used to decimate the samples before the FFT calculation. If the audio processing rate is 8000, and (for example) the "Rate Divisor" is set to 4, the 'internal' sample rate for the FFT input is only (8000/4=) 2000 samples per second, reducing the CPU power and increasing the FFT resolution.
BUT: The higher the "Rate Divisor", the lower the maximum frequency that can be detected with the FFT.
Note: The sample rate may have already been decimated at an earlier stage ! See 'Audio Settings'.
FFT input size
The number of samples that are processed by a single FFT calculation. Must be a power of 2. This parameter influences the frequency resolution in the FFT output.
Since program version V1.2, the FFT Size does no longer define the speed of the scrolling waterfall !
The higher you set the FFT size, the more frequency esolution you will get, but the longer it will take to calculate an FFT. On slow PCs (<100MHz), you should leave the FFT input size below 16384 samples. If the CPU is too slow, the waterfall will scroll slower than it should !
A detailed discussion of FFT input size, decimation, sample rate and frequency resolution is here.
FFT window function
Selects the windowing function for the samples in the time domain. Each block of samples which enters the FFT will be multiplied with this function, which usually has a shape of a raised sine wave, with values near zero at the edges of the window, and one in the center. For most applications, the Hann window (mistakingly called "Hanning") is often the best choice because it has a good dynamic range (suppression of sidelobes) while maintaining a low equivalent noise bandwidth. For details, search Wikipedia on "window function" (used to be on en.wikipedia.org/wiki/Window_function). The window functions implemented in SL are:
Rectangle, Hamming, Hann, Gauss, Nuttall, and various Flat Top windows. They can also be set through the interpreter.
Notes on the FFT windowing functions:
- The equivalent noise bandwidth for the currently selected FFT parameters is displayed in the info box below the FFT settings.
- The formulas of the FFT windowing functions are contained in the SL installation archive, in the file 'Goodies/fft_windows.txt'. You can load that file with DL4YHF's "CalcEd" ("calculating editor") to plot the windowing functions in a graphic window.
- for the experimental correlogram display, you may have to use the rectangular window .

FFT Type and Center Frequency
"Real-number FFT": Preferred type for all broadband applications, where the displayed frequency range shall start at "DC" (0 Hz). No frequency conversion inside the spectrum analyser.
"Complex input with frequency shift": For narrow-band applications, if only a small frequency range (centered around any audio frequency) is of interest. This only works together with a decimation factor of 4 or higher. Internally, the analysed signal is multiplied with a complex oscillator signal (the "center frequency"). The complex signal (with "I"- and "Q"-branch) is then decimated, and the decimated signal (with a low sampling rate) is fed into a complex FFT.
"Complex input with separate I/Q channels": also a complex FFT, but no oscillator and complex I/Q multiplier inside the frequency analyser. Instead, the I- and Q-branch is fed into the analyser via two separate input channels. These two channels can be the LEFT and RIGHT input of a soundcard running in stereo mode, or an external two-channel A/D converter. More information about I/Q processing with Spectrum Lab is here.
Include F.O. calibrator (Frequeny Offset Calibrator)
This is only possible if the FFT type is set to "complex input with frequency shift". With this option, the frequency error (measured by the frequency offset detector) is subtracted from the complex oscillator frequency as explained in the previous paragraph.
Zero-pad input if not enough samples available yet
If this option (checkmark) is set, the FFT input will be padded with zeroes as long as not enough samples are available for input yet.
This option can help to 'see something quickly' if the FFT size (length * decimator) is very large, as in the 'very slow QRSS modes'.

FFT output unit
Select the display unit for the FFT results (for spectrum graph and waterfall):
V (volts), W (power in watt), and several logarithmic scales (dB, dBuV, etc).
The linear scales (voltage or power) are sometimes better to detect very weak signals in the waterfall display, expecially with high noise floor.
The logarithmic scales ("dB" with different reference levels) are more common if the input signal has a high dynamic range.
Absolute unites (like V, dBuV and a few others) only make sense after an amplitude 'calibration' as explained here.
Hint: You can compare signal amplitudes directly in decibels with the "readout cursor" in the spectrum display. The cursor function also uses the "FFT output unit" for display, so this name is a bit misleading.
FFT internal average
This parameter may be important if you try to 'dig' very weak signals out of the noise.
A value of 0 will give no averaging, a value of 3 will already reduce the random noise a bit, and will make the spectrum look smoother, so weak coherent signals crawl out of the noise on the spectrogram display. The higher the average value, the greater the smoothing effect, but if the value is too high the spectrum (and spectrogram) will react too sluggish. See also: Overwiev of different averaging- and smoothing options.

FFT smoothing (parameter: number of neighbour bins)
This option can help to detect very weak, but relatively "broad" signals. The smoothing parameter are the number of "neighbour" bins in the FFT which are averaged to form the smoothed spectrum. Internally, a Gaussian kernel is used. Unlike FFT averaging (which operates on consecutive FFTs), the smoothing option affects the shape of a signal (for example, it turns a 'sharp peak' from a coherent signal into a wider (Gaussian) 'hump'. But if the signal is already a hump with a certain bandwidth anyway, this option can help to squeeze the last fraction of a decibel out, so a signal becomes visible in the spectrum display. Try to match the smoothed bandwidth to your observed signal to get the best result with this function .. it may require some trial-and-error. The FFT Smoothing was revived in SpecLab for the EVE experiment.
FFT output type
Set to "Normal (amplitude only)" for a normal spectrogram without phase (or radio-direction) information,
or to "Complex (real + imaginary part)" for special applications - for example phase analysis,
or to "Radio Direction Finder" for a radio-direction-finding spectrogram where the colour indicates the azimuth angle.
Note 1 : Some FFT output types don't affect the waterfall display, but only the FFT export (as file) !
Note 2 : The spectrum replay function (which transforms spectra back into audible signals) only works if the FFT output is set to "complex", otherwise the phase information in the original signal gets lost.
Note 3 : The triggered averaged spectrogram (with one average buffer for each of the spectrogram lines) only works if the FFT output type is set to "Normal (amplitude only)".

#### New FFT windowing functions

Since May 2014, a few new 'flat top' windowing functions were added in Spectrum Lab, mainly out of curiosity, and to find out if they made a difference with 'real-world radio signals'.

Screenshot with a few 'classic' and 'new' FFT windowing functions.
'HFT248D' is one of the new functions ('Flattop with 248 dB sidelobe suppression').

The following windowing functions can be selected on the 'FFT settings' panel (besides the classic Rectangle, Hann, Hamming, and Gauss window).
The new functions were implemented according to a publication by the Max-Planck-Institut für Gravitationsphysik (Teilinstitut Hannover), written by G. Heinzel, A. Rüdiger and R. Schilling:

Spectrum and spectral density estimation by the Discrete Fourier transform (DFT),
including a comprehensive list of window functions and some new flat-top windows.

The article was publicly available as PDF at http://edoc.mpg.de/395068.
If you really need such 'high dynamic range spectra' (at the expense of equivalent noise bandwidth),
read that article to decide which of the following windowing functions is best suited for your application !
Also consider that the normal compilations of Spectrum Lab use 32-bit floating point numbers (with 24-bit mantissa), thus you won't see much difference between FFT windows with 196 or even more suppression of the sidelobes (see screenshots further below).

Nuttall '4 B' :
Low frequency resolution but large dynamic range (sidelobes 93 dB below the main lobe),
NENBW (Normalized Equivalent Noise BandWidth) = 2.0212 frequency bins
(for comparison, Hann-window: NENBW = 1.5 bins, sidelobes 31.5 dB below the main lobe)

Flattop '5 F' : Fast decaying 5-term flat top window
Low frequency resolution but fast decay of sidelobes.
NENBW = 4.3412 bins
highest sidelobe at -57.3 dB, located +/- 5.31 bins from the peak

Flattop '5 M' : Minimum sidelobe 5-term flat top window
Low frequency resolution but good attenuation of sidelobes.
NENBW = 3.8852 bins
highest sidelobe at -89.9 dB, located +/- 5.12 bins from the peak

Flattop -95 dB : Flat top window with -95 dB sidelobes (by G. Heinzel: "HFT95", D.3.2)
NENBW = 3.8112 bins
highest sidelobe at -95.0 dB, located +/- 7.49 bins from the peak

Flattop -144 dB : Flat top window with -144 dB sidelobes (by G. Heinzel: "HFT144D", D.3.5)
NENBW = 4.5386 bins
highest sidelobe at -144.1 dB, located +/- 7.07 bins from the peak

Flattop -196 dB : Flat top window with -196 dB sidelobes (by G. Heinzel: "HFT196D", D.3.6)
NENBW = 4.8347 bins
highest sidelobe at -169.6 dB, located +/- 10.41 bins from the peak.
Note: This sidelobe attenuation reaches the dynamic range of 32-bit 'single-precision' floating point numbers.

Flattop -248 dB : Flat top window with -248 dB sidelobes (by G. Heinzel: "HFT248D", D.3.9)
NENBW = 5.6512 bins
highest sidelobe at -248.4 dB (theoretically!), +/- 13.37 bins from the peak.
Note: This exceeds the dynamic of 32-bit 'single-precision' floating point numbers (as used for the FFT in Spectrum Lab),
so you will hardly see the sidelobes with this windowing function at all.
This windowing function was only implemented in SL to see if it 'makes a significant difference' compared with the 'Flattop -196 dB' window. Without using 64-bit 'double precision' floats for the entire processing chain, it didn't. The screenshot of a 'pure sinewave' spectrum with this window, shown below, was made with a special compilation of spectrum lab using 64-bit floating point samples.

Examples: 40 kHz sinewave from SL's test signal generator, 96 kSamples per second, 512*1024 point FFT, using different FFT windowing functions:

Spectrum of a pure sinewave, Hann window.
Often a good compromise between frequency resolution and dynamic range,
but in this example, the dynamic range is not sufficient to reveal
the 'purity' of the test signal (phase noise, etc).

Spectrum of a pure sinewave, Flattop window with sidelobes at -144 dB.
Wider peak (due to the 'flat top' with NENBW = 4.5386 bins) but more dynamic range.

Spectrum of a pure sinewave, Flattop window with sidelobes at -196 dB,
using single precision floating point numbers (32-bit, normal compilation).
The sidelobes are buried in rounding noise ('grass') at -195 dBfs.

Spectrum of a very pure synthetic sinewave, Flattop window with sidelobes at -248 dB,
using a special compilation of Spectrum Lab with double precision floating point numbers.
This dynamic range is hardly necessary for 'real world' signals from any A/D converter !

### Spectrum Display Settings

These settings are part of the Setup Dialog which can be opened from SL's main menu via "Options".."Spectrum Display Settings". Here just some parameters which need explanation. Parameters with a (2) are located on the second part of the spectrum display settings (etc), because the space on the first tab was not sufficient.

Vertical Frequency Axis
Affects the layout of the spectrum/spectrogram screen. The classic waterfall display scrolls from TOP to BOTTOM, so the time axis is vertical and the frequency axis is horizontal. If the option "Vertical Frequency Axis" is checked, the frequency axis will be rotated by 90 degrees and the waterfall will scroll from RIGHT to LEFT (which is better for HELL modes and for visual decoding of slow CW).
Logarithmic frequency scale (2)
With this checkmark set, the frequency scale for both waterfall and spectrum graph will be logarithmically scaled (which is preferred by musicians). Otherwise the frequency scaling is linear.
Mirror for Lower Side Band (2)
Usually the lower frequency will be on the LEFT or LOWER side of the frequency axis. With this option set ("checked"), the frequency axis will be mirrored so the lower frequency will be on the RIGHT or UPPER side of the frequency axis (depending on the "Rotation" of the frequency axis).
Split frequency scale (2)
Allows to split the frequency scale for the  waterfall and spectrum graph in two sections. The frequency ranges of both settings can be defined independently. If the "split frequency axis" is enabled, you can divide the screen area with the mouse on the small 'gap' between both parts on the frequency scale. When the mouse cursor is replaced with the splitter symbol, hold the left button pressed and move the mouse.
This option can also be activated from a popup menu on the frequency scale (use the right mouse button to open a popup menu, while the mouse cursor is on a certain screen element).
Amplitude grid
activates a grid (overlay) for the spectrum graph, usually in 10- or 20-dB steps (depends on display unit and height of the graph area).
Double-width waterfall lines
is an option added for high-resolution screens. With this option, each new line of the spectrogram is drawn twice on the screen. If you have a monitor with a vertical resolution of 1536 pixels, try this option if you cannot see individual lines in the spectrogram. The option is also good for fast non-scrolling spectrograms (waterfalls) without causing unnecessary CPU load (because it halves the number of FFTs calculated per screen sweep).
One pixel per FFT bin
With this option enabled, the frequency scale will always be stretched so one screen pixel (along the frequency scale) will represent exactly one FFT bin. The 'Max' frequency field on the control panel on the left side of the main window will be disabled if this option is active (you can only enter both 'Min' and 'Max' frequency if the 'one pixel per bin' option is off). The benefit of this option is that you always see the maximum frequency resolution for a given FFT size on the screen (but you may have to pan the frequency scale around to see different frequency ranges).
Tip: There is an option to zoom into the spectrum with exactly 'one pixel per bin' in the popup menu of the main frequency scale.

Optimum waterfall average
Is especially useful for slow waterfalls. With this option, as many FFT's as possible are calculated and summed up before they go into one line of the waterfall. This greatly smoothes the noise for 'overnight recordings' or if you want to get a nice curve of your receiver's passband. The number of FFTs added for one waterfall line can be examined in the Debugging Window ("Waterfall average count"). It depends on the waterfall scroll interval and the time required to collect enough audio samples for one FFT.
Multi-Strip Waterfall (with "number of pixels per strip")
Speciality for long-term observations. If this option is enabled, the spectrogram screen will be divided into a number of vertically (or horizontally) stacked "strips" which will show the history of a long time on a single screen - for the expense of the displayed frequency range, or frequency resolution. The parameter "number of pixels per strip" defines the height of each strip, if the frequency scale runs vertically, othewise its width.
Triggered Spectrum (should read "Triggered Spectrogram" but there wasn't enough space ! )
Only for "very special" applications. If this checkmark is not set, the spectrum runs 'free' (without the need for a 'trigger', only controlled by the waterfall scroll interval). Otherwise, new spectra are calculated only after a certain "trigger" event. More details are here.
.. may be more friendly to the eye for very fast spectrograms (short "scroll" intervals, which do not really scroll in this mode).
An example for this option can be recalled from the "Quick Settings" menu: select "Natural Radio"..."Sferics and Tweeks". It uses a 2-millisecond drawing interval - quite impossible to see any details if the image scrolls 500 times a second !
In non-scrolling waterfall mode, the spectrogram can be triggered (i.e. start one sweep across the display on a configurable trigger condition, then stop and wait for the next trigger event).
Peak Detecting Cursor
Sets the mode of the frequency/amplitude readout cursor. When you move the mouse across the waterfall or the spectrum, the displayed frequency and amplitude is the PEAK value, and the frequency resolution of the displayed value is much higher than the FFT bin width (thanks to an interpolating algorithm which was suggested by DF6NM. Works best when FFT windowing is set to "Hanning". Readings with a milli-Hertz accuracy (not just  resolution) can be taken after calibrating the soundcard's sampling rate.
Peak-holding spectrum graph
If this option is set, the spectrum graph shows an additional curve with the peak value of the previous N seconds. The number of seconds can be set between 0.5 and 60 . This function is good for reading the amplitudes of "short tone bursts" or similar, or to display the result of a frequency sweep. For this reason, the peak values can be cleared and "frozen" via interpreter command too.
The colour of the peak curve in the spectrum graph can be modified here.
Note: The actual peak detection is done more frequently than the display update ! Some "peaks" may have such a short duration, that you won't recognize them in the momentary spectrum graph, but only in this peak indicator.
Long-term average spectrum graph (over a range of spectra from the spectrogram screen)
If this option is set, the spectrum graph shows yet another curve : a 'long-term average graph'. This option was added in 2007 for an "extreme" weak signal test (Venus radar), which required an extra long integration. Details about the long-term average spectrum display are here (in another document).
Right next to the checkmark to enable the long-term average display, there's a small button labelled "clr". You can use this button to clear the average buffer (to start an all-new average calculation).
Just below the checkmark you can specifiy an optional half-life time. If non-zero, this interval specifies the time after which the values in the long-term average buffer have decayed to 50 % (i.e. half values). The decay is exponential; i.e. the values will never drop to zero (like a radioactive decay).
Emphasize MIN+MAX values
With this box checked, both min- and max values will be displayed in the spectrum graph. Actually, the area between min- and max value which occurred within one
Show Spectrum as Bargraph
Normally, the spectrum graph is drawn as a thin curve. With this option, it is painted using solid bars, which are better visible from a distance (looks a bit like a colourful level indicator of a graphic equalizer, because the colours of the bars indicate the amplitude since they use the colour from the waterfall palette).
Show... (selection combo)
This combo box defines whether the spectrum graph and/or the spectrogram (aka waterfall), or the 3D spectrum is visible in the main window. Futhermore (if the frequency axis shall be vertical) it defines if the spectrum graph shall be on the left or on the right side of the screen ("show both / plot on the right" means "show both spectrum graph and waterfall, with the graph on the right side").

Show Amplitude Bar
This 'amplitude bar' is the blue strip which runs along the spectrogram (optionally). The white line inside it shows the (broadband-) amplitude present at the input of the spectrum analyser, measured at the same time when the data for the FFT were calculated. The amplitude bar can be parametrized on the second part of the 'Spectrum Display Setting' - see next chapter. The "..visible"-checkmark only turns the bar on and off (if you don't need it).
Mathematics
Usually set to "none", if one or two independent channels shall be displayed in the spectrum window. The other options only work if two input channels are connected to the main spectrum analyser:
"CH1 - CH2" = calculate spectra for both channels, subtract the 2nd from the 1st channel, and only show the difference
"CH2 - CH1" = simular as above, but subtract the spectrum of channel 1 from the spectrum of channel 2.
An example can be found in the preconfigured setting "SpecDiff.usr", where CH1 is the test signal for a filter, CH2 is the filter output, and the display shows "CH2 - CH1". In that example, that's the filter's frequency response, because the filter is fed with broadband noise from the test signal generator.
Spectrum Graph Area (pixels)
Defines how large the spectrum graph area shall be, if both graph and spectrogram (waterfall) shall be visible at the same time. The default value is 100 pixels.

Channels / Connections
This button takes you to the circuit window where you can select the input channels for the spectrum analyser (which can be connected to different "taps" within the test circuit; not only to the inputs from the soundcard).
Waterfall Scroll Interval
Defines how much time passes between two steps of the waterfall. If the option "Optimum Waterfall Average" is not set, this parameter also defines the time between two FFT calculations. Be careful not to make this value too low, unless you have a quite fast PC. Don't expect your 50MHz-486 to do five FFT-calculations with 32768 input samples per second - this example requires a 266MHz-P2. A modern machine by today's standards does a lot more of course.
With the "automatic" option, the waterfall scroll interval will be automatically selected, depending on the current FFT size, for a 50 percent overlap (which makes sense due to the FFT windowing).
Note 1: The spectrum replay function only works if the scroll interval is set to "automatic, for 50 percent overlap".
Note 2: For the reassigned spectrogram display, overlaps of 50, 75, or 87.5 % worked best.
Note 3: The "scroll interval" has no effect if the option "triggered spectrum" is enabled and set to "trigger for ONE LINE of the spectrogram". This gives you the opportunity to control the waterfall scroll interval through an external sync signal (it was used for a doppler radar experiment once).
Waterfall Time Grid
Produces an overlay in the spectrogram with periodic time markers. As long as the 'Source' field is empty, the 'Interval' field usually defines the number of seconds (or minutes) between to time ticks. "Style" defines how the time markers shall be drawn over the spectrogram (as dotted line, solid line, or just a small "tick"). Each marker can optionally be labelled in a selectable format, or user-defined formatted text. If the "Label" combo set to "User Defined", you can define the format string for the time label in the field "user-defined time label format". Some examples for suitable format strings are here . Since 2006-10, the user-defined label may even be a variable string expression (evaluated by the interpreter before printing the label) like the following example (caution, for advanced users and 'special applications' only) :
str("## dB",peak_a(500,3000))
The str()-function used in this example does is explained here (it converts a numeric value into a string). Some black magic lets the peak-function in this example use the spectrum "under" the time marker to calculate the peak amplitude in the specified frequency range.
The 'Source' field inside the group 'Waterfall Time Grid' can be used for special applications, where the source for the time markers shall not be the time, but something else. For this purpose, any numeric expression can be entered in this field. The result from this expression will tell where the markers are placed (in combination with the 'Interval' field: Whenever the value calculated from the 'Source' expression, divided by 'Interval', truncated to an integer number, gives a new value, a new marker will be painted on the waterfall. Too complicated ? Here's a simple example: With 'Source' set to water.lines - 1 - water.line_nr, the timescale will not show a count of seconds, but the current pixel position.
By default, the time markers painted near the waterfall time grid will show the current date and time, or (while a file analysis is in progress) the time-of-recording. You can change this time in the file analysis dialog.
Note: If a GPS receiver is connected, and SL's GPS / NMEA decoder properly configured, the waterfall time labels may also show the current geographic location. Details on that in an extra document (option 'show position in spectrogram'). The position is appended to the time, in text form.
Amplitude Range and Spectrogram Options (tab 2)
Allows you to reduce the displayed amplitude range for the waterfall and spectrum graph. The default settings cover a large dynamic range (like -120 dB to 0 dB). If, for example, you are only interested in weak signals between -60 and -50 dB, adjust this range accordingly.
The 'Offset' can be used to modify the displayed decibel scale. It is not necessarily a fixed value, but a numeric expression which will be periodically evaluated by SpecLab's interpreter. The gray field right next to the input field shows the current value. This feature was used to take the automatic gain of a "real" receiver into consideration when displaying "absolute" voltage readings in the spectrum graph.
Note: Of course, you can adjust the waterfall colour palette with the 'contrast' and 'brightness' sliders, so everything below -60 dB will be black for example, and everything above -50 dB will be white; but reducing the displayed amplitude range here will also make the spectrum graph look better.
Additional, the visual AGC function can be turned on for the spectrogram display. Details about the visual AGC are here.
Amplitude Bar (2)
Shows the total amplitude in a coloured bar, running alongside the spectrogram display. In contrast to the spectrogram, the amplitude bar doesn't depend on frequencies. The size and display range of the amplitude bar can be defined independently in its control panel (regardless of the "Displayed Amplitude Range" for the spectrum / spectrogram). The following controls can be found in the group "Amplitude Bar", which is on the second part of the spectrum display configuration screen:
- visible : turns the amplitude bar on/off
- with scale: means a scale (in percent) shall be visible near the amplitude bar, covering a part of the frequency scale
- size: displays the width or height of the amplitude bar in pixels (whether this is "width" or "height" depends on the screen layout / rotation )
- show channels from watch window: defines which of the channels of the watch window shall also be plotted into the amplitude bar. These are decimal channel numbers, separated by comma. For example: 1,2,3 means "plot the plotter-channels number one, two, and three also into the amplitude bar".
- display range: Defines the amplitude scaling for the amplitude bars (the "seismogram"), in percents of the maximum analog/digital converter's input.
100 % means the display range of the amplitude bar covers the full ADC swing (the point of clipping, which should be avoided). 10 % display range is more suited for most applications. Note: The additional channels which can be plotted into the amplitude bar are not affected by this parameter. They are entirely controlled by the "min" and "max" values entered in the watch-window.

Options for the frequency axis (2)
Contains the following checkboxes, which were once on the first tabsheet (before running out of space there). This group contains the following options, which should speak for themselves:
• show grid in spectrum graph
• show grid in waterfall display
• use dotted grid in waterfall (note, this applies to the FREQUENCY scale only)
• split frequency scale
• logarithmic frequency scale
• mirror for lower side band
• Radio Frequency Offset: Added to the displayed frequencies, usable for external (fixed) frequency converters, in addition to the 'VFO frequency' (the latter being controlled by Spectrum Lab, for software defined radios and similar).
Options for Triggered Spectrogram (3)
Triggered Spectrum / Triggered Spectrogram
If the option 'Triggered Spectrum' is set, the universal trigger function can be used to trigger the acquisition of data for the next FFT (=a single waterfall line) or a complete spectrogram sweep (= a complete waterfall screen). With this option, you can -for example- realize an external trigger if you connect the trigger to one channel of the soundcard, and the spectrum analyser itself to another channel. See example in the next paragraph.
Note: The triggered spectrogram only makes sense in 'Non-Scrolling' Waterfall mode. One trigger starts a full sweep across the spectrogram. When the spectrogram is complete, the spectrogram is paused, and the program waits for the next trigger. This mode is often used along with the average function explained in the next paragraph.
Triggered Spectrogram Average
Only works if :

The triggered spectrogram, together with this special 'Average' option, it can be used to dig weak but periodic signals ("pings") out of the noise, as explained in this example.  In that mode, there are individual average buffers for every spectrogram line.  The "Reset" button on this panel can be used to erase those average buffers to start an all-new reception cycle. The field labelled 'Averages (one per line)' defines how many spectrogram sweeps shall be accumulated.
An overview of the various AVERAGING modes is here .

Note:
Some of the settings explained above apply to the currently selected channel of a spectrum analyser, but most of them are common of all channels. To toggle the channel number, click the button labelled

"Shown: Settings for Analyser 1, channel 1"   or   "Shown: Settings for Analyser 1, channel 2" ... etc

Every click on this button toggles the channel number.

### Spectrum Buffer Settings

To scroll the waterfall (spectrogram) back in time, a large buffer can be used, which stores a lot of calculated spectra (more or less, the results of the FFT calculations). The contents of this buffer can be browsed with the 'buffer overview' in the control bar on the bottom of the main window.
This buffer is in RAM, but can -optionally- also be a large disk file. Which is best for you, depends on your application. If you don't need to scroll back in time, only use a small RAM buffer (which is required for repainting the spectrogram, after changing the contrast/brightness values, zooming into certain frequency ranges, etc).
The following 'Spectrum Buffer Settings' can be modified on the configuration screen:

Buffered lines in RAM
This edit field is used to define the maximum count of spectrum lines buffered in the PC's main memory. The spectrum buffer is required to be able to "scroll back in time" while recording new spectrum samples.
If you experience periodic hard disk accesses after every FFT (or waterfall step), you should reduce this value because your PC runs out of "real" RAM and starts swapping memory from RAM to disk.
A value of 200 is ok for all PCs even with only 16MB RAM (if not too many other programs are running).
On machines with 128MB RAM and more, use 400 lines.
If you have 256 MB RAM or more, use 800 lines so the full screen can be repainted after zooming or modifying the waterfall colours.

This parameter will be effective only after exiting and restarting the program because the buffer is allocated only once during program initialization.
Use file buffer
A file can be used as an extra large display buffer. Also enter the name of the disk file here, so you can have different buffers for different applications. Switching from one file name to another sometimes requires exiting and restarting the program.
Max. FFT bins in file
To make more efficient use of the buffer file, you can define how many FFT bins (frequency samples) shall be written into the file. If, for example, the spectrum analyzer uses an FFT size of 65536 points, but you are only interested in a small portion of the spectrum (say a quarter of the bandwidth covered by the soundcard), enter "16384" here, or even less:
In an other "extreme" case, you may only want to observe 19.5 to 22.5 kHz while your soundcard runs at 96 kHz (so the FFT covers 0..48 kHz). To save space in the buffer file, you only record (22.5-19.5)kHz / 48kHz = 6.25% of the total bandwidth. From a 65536-point FFT, you only need 65536 * 0.0625 = 4096 bins. This is the value to be entered in the field "Max  FFT bins in file". (Why so complicated ? All entries in the file buffers have the same size for simplicity, and the buffer does not change its file structure automatically when you select another FFT resolution).
The "center" of the frequency range which will be written into the spectrum file buffer will be taken from the "center frequency" of the main spectrogram. If you zoom out of the narrow frequency display, parts of the waterfall which are no longer present in the RAM buffer will remain black if they are not contained in the buffer file.
If the currently used FFT size greater than the count of bins in a buffer file entry, a warning message will be displayed in the setup screen, like this:
 WARNING: The FFT size (65536 bins) exceeds the currently used buffer (4096 bins).

Having read the explanations above, you can decide to accept recording only a part of the input spectrum in the buffer, or to change the buffer settings (set the number of bins in the buffer to the same value as currently used under FFT settings. But, to make the changes effective, the old buffer file must be discarded, and a new one (with different structure) must be written.
Max buffer file size
Limits the size of the spectrum buffer file (if such a file is used at all). Helps to reduce the risk of running out of harddisk space, which will cause problems under windows. For most applications, a buffer size of 200...2000 MByte is sufficient, and most modern HD's have many gigabytes more than this.

## Display Colour Settings

These settings are part of the Setup Dialog, now on the 3rd part of the "Spectrum" display settings.

Colours:
Used to customize some colours used for grids, graphs, scales, text labels, etc. (this does not include the color palette for the waterfall)
Spectrum graph background, Spectrum graph grid, Pens1 ... 4 :
Click on one of these panels to modify the color used to display these parts of the "spectrum graph".
Pen 1 is used to draw the current or averaged spectrum,
Pen 2 for a temporary (instantaneous) spectrum which will be added to the average spectrum (if averaging is ON),
Pen 3 is used for the peak hold indicator (if enabled),
Pen 4 is used for the FFT-based filter's frequency response (and other optional elements like the spectrum alert function) .
Note: The pen colour for the reference spectrum curve is defined on the "Reference Spectrum / Frequency Response" tab of the configuration window.
Frequency scale background, Frequency scale foreground:
Set the colours of the frequency scale between spectrum graph and waterfall (which was black on orange in earlier versions).
Waterfall grid, Waterfall Label Text, transparent waterfall label:
Color for the waterfall grid, text on scales and transparancy of the text. Some users prefer transparent text, others opaque. If you use a black & white waterfall palette, you can use blue waterfall grid, blue label text and transparent labels for example (will always be visible). If the checkmark for "transparent" is off, the text will be opaque (it appears in a solid rectangular box with the waterfall grid color). The text itself always appears in the "Label Text" color. Do not use the same colours for "Waterfall grid" and "Label Text" if the text is not transparent !
The waterfall frequency grid can either be a solid or dotted line; individual frequency grid lines can be added or suppressed with the user-defineable frequency markers.

## Frequency Marker Settings

Up to twenty(?) frequency markers can be displayed on the frequency scale (for waterfall and spectrum graph). A table like this is used to "connect" the marker either to a fixed frequency or to any "frequency-dependent" parameter:

(screenshot "Markers" in the Configuration and Display Control window)

A name must be supplied for every marker which shall be visible on the frequency axis or in the waterfall diagram. Lines in the marker definition table are treated as 'unused entries'. A every frequency marker's name will be displayed as a "hint" when the user moves the mouse across the marker on the frequency scale.
The value column shows the current position of the marker (frequency in Hz, with or without "RF" offset - see below). For all markers, this will be the last position to which the 'operator' dragged the marker via mouse... unless one of the functions presented below doesn't prevent that.
The type of a marker defines how it shall appear on the screen. It is defined as a combination of letters which will be explained in the following section in detail. The type is optional. By default, a marker only appears as a diamond-shaped icon on the main frequency axis.
The color of a marker can be modified by clicking on the panel in the lower left corner of the dialog window. Additionally, this column in the definition table may include a combination of the "flags" shown just below the table.
The marker's RF-flag defines if this marker displays a RADIO-FREQUENCY (RF=1) or a BASEBAND-FREQUENCY (or "AUDIO-FREQUENCY"; RF=0). A radio frequency includes the current VFO-frequency, which is added to the baseband frequency for the display. Details about BASEBAND- and RADIO frequencies are here.
The set procedure is an interpreter command which will be executed whenever the user tries to move the position of the marker with the left mouse button held down. The new frequency value is passed to this command on the local variable "x". If you use this feature, you can use the frequency marker like a slider.
The read function is a numeric expression (see examples) which is periodically evaluated (every 500ms or so). This is done because a frequency marker can be connected to something which changes its value by itself, for example the AFC center frequency of the digimode decoder during receive. If the result of the read function changes, the marker will automatically move along the frequency scale. If no read-function is specified for a marker, its position is freely movable with the mouse, and it's frequency ("value") will be saved between two SpecLab sessions. Thus, a marker can be used like a "variable" to store a single frequency value. To markers can be used to store a frequency range, etc.
Some examples for the use of frequency markers as sliders (to control a few of Spectrum Lab's components):

 Set Procecure Read Function Remarks generator[0].freq=x generator[0].freq display and modify the frequency of the first sine wave generator circuit.osc.freq=x-650.0 circuit.osc.freq+650.0 Used for the VFO in the VLF software radio with 650 Hz "audio IF" filter[0].fft.fc=x filter[0].fft.fc reads or modifies the center frequency ("fc") of the FFT-based filter. filter[0].fft.fs=x filter[0].fft.fs reads or modifies the frequency shift ("fs") of the FFT-based filter. Often used as a software "beat frequency oscillator" in software-defined radios.

Since 2009-06, frequency markers can also be used -a bit easier- without having to define a special "set"- and "get"-function. If a frequency marker does *NOT* have a special 'read function' (as explained above), it can still be moved on the main frequency scale with the mouse, and the current value (frequency) of a frequency marker can be polled from the interpreter using one of the functions listed further below.
An overview of Spectrum Lab's interpreter functions can be found here.

### Functions (and -commands) to access frequency markers through the interpreter

Frequency markers are numbered from N=1 to 10, like in the 'frequency marker definition' table shown above. The frequency, and possibly some other properties of a frequency marker, can be accessed through the interpreter using the following commands (or functions):

fmarker[N].freq
returns (or sets) the current frequency of a marker. Unit is Hz.

Examples:

"f="+str(fmarker[1].freq)+" Hz, a="+str("##",peak_a(fmarker[1].freq-50,fmarker[1].freq+50))+" dB"
(used in any of the programmable buttons, "variable expression" field)
Displays the frequency of that marker (in Hz), and the peak amplitude in a frequency range "near" that marker.

### Frequency marker types

The type of a frequency marker defines how and where a frequency marker appears. The following marker types can be used, also as combinations of these lower case letters:

s (frequency marker type 'scale')
Marker appears on the main frequency scale.
w (frequency marker type 'waterfall grid line')
A thin grid line at the marker's programmed frequency appears in the waterfall, using the marker's color which can be defined on the 'marker settings' tab. This makes it possible to have additional lines in the waterfall's frequency grid. You can use to mark odd frequencies like 15.625kHz in the waterfall which would usually not appear on the automatically generated grid (which can be enabled and disabled on the 'display settings' tab).
d (frequency marker type 'disable frequency grid line')
Suppresses one of the frequency grid lines on the waterfall. For example, there may be a frequency scale from 10..20kHz with visible grid lines on the waterfall spaced 1kHz. You have an interesting signal at 16 kHz (let's call it GBR) and don't want to have this particular frequency covered by a frequency grid line. Define a marker named "GBR" with the type "d" or even "sd" (so you can see it on the frequency scale). From now on, the 16kHz-line is ommitted (excluded) in the frequency grid.

As noted in the frequency marker settings, a marker can be programmed to use either the baseband- or the radio-frequency.

• A radio frequency includes the VFO frequency (= "the frequency to which the external radio, or downconverter, is tuned to").
• A baseband frequency does not include that frequency offset.

For example, let's assume Spectrum Lab is connected to a software-defined receiver (SDR), which is tuned to a center frequency of 7.03 MHz ( = "VFO frequency" displayed on the SDR control panel). The quadrature IF (intermediate frequency) output is sampled 44100 times per second (f_sample=44.1 kHz).
This means, the I/Q stream covers a baseband frequency range of -f_sample/2 to +f_sample = -22050 Hz to +22100 Hz.
An audio tone appearing in the baseband at 1000 Hz corresponds to a radio frequency of 7.031 MHz .

Markers displaying RADIO frequencies should be used ...
• to tune the radio (VFO control)
• to show the frequency of radio stations in the frequency scale

Markers displaying BASEBAND frequencies are better suited ...

• to adjust the "audio filter" (bandwidth and center frequency; or lower and upper cutoff frequency)
• to indicate certain frequencies which are *not* related to the VFO tuning frequency, for example the receiver's audio passband, FM stereo pilot tones, etc.
• to control the test signal generator in Spectrum Lab (because the test signal generator produces baseband signals, not radio frequencies)

## Audio File Settings (formerly 'Wave File Settings')

The wave file setting dialog can be opened through the main menu; select Options ... Audio file settings (formerly Wave file settings).

Save Options : Options to save incoming or outgoing audio as a file (*.wav or *.ogg).

'Use RAW file instead of WAVE-format'
The default format (which should be sufficient for most applications) is WAVE audio - not 'raw' audio. When starting to save audio via the file menu (File..Audio Files and Streams..Save XYZ as audio file), the file type can actually be selected through the file selector dialog).

This option should be set for accurate post-processing
- it uses additional 'chunks' in the RIFF wave header, for example a precise timestamp for the first sample in the file, and possibly some other specialities. Well-behaving programs will not have any difficulty to skip these non-standard chunks... otherwise, turn off this option, but then you will not have accurate timestamps, GPS data, or other parameters available for post-processing.

'Don't save until timestamps are valid'
If this option is checked, the audio-saving process won't start until accurate timestamps are available (from a GPS receiver or similar). This is important only for very special applications, for example when recordings from different sites are to be aligned / combined by the timestamps (in the sampled data). This option prevents recording 'useless' data, for example if audio samples are available, but the GPS receiver has not locked in yet.

'Save extra data in auxiliary files'
Saves some 'extra' data (timestamps, GPS data, etc) in an extra file. Only necessary when the post-processing software is unable to process wave-files which contain additonal information (besides the sampled data).

'Decimate saved audio samples to NNNN samples/second'
Helps to reduce the size of logged audio files, if the logged bandwidth doesn't need to be as large as the bandwidth covered by the audio input device. But since the support for Ogg/Vorbis, you'd better use this file format to reduce the disk space usage (because Ogg/Vorbis is a compressing audio format, which the normal 'wave audio' format is not).

16 or 24 bits per sample
Only applies to wave files, but not for Ogg/Vorbis.

More about using wave files for logging and analysis can be found here . If you wonder about 'auxiliary' files (*.aux) being written along with wave files (*.wav), read this note about GPS data logging (to turn off AUX files, the GPS-'emission'-interval must be set to zero).

## Amplitude Calibration

To realize absolute voltage readings, level readings in dBuV, etc, the program needs to know the relation between input voltage and A/D converter value. For example, a 16-bit analog-to-digital converter may reach the maximum positive output value of 32767 at an input voltage of 200 mV. This value (input voltage for the maximum ADC value) can be entered in the setup window  (from the main menu: Options ... System Settings .. Amplitude Calibration . It doesn't matter what hardware is actually used - it may be a soundcard, an external A/D converter on the serial port, a software defined radio (like SDR-IQ or Perseus).
The value entered in the field labelled max ADC input voltage is the single peak voltage ("Vpk" - not the peak-to-peak voltage) fed into the soundcard, SDR, or whatever. You can measure the single peak voltage with an oscilloscope if you have. The typical procedure to determine this value is as follows:

• Connect a signal generator set to sine wave output, with adjustable amplitude to the analog input of the soundcard / SDR / etc. Turn the output voltage low initially to avoid damage to the receiver !
• Open the "input monitor scope" in Spectrum Lab, and set the vertical magnification to 1 (which is the default)
• Slowly increase the signal generator's output amplitude, until the sine wave in the input monitor reaches the clipping point (i.e. touches the upper and lower edge of th scope display).

• Measure the peak voltage of the signal generator (with a real oscilloscope).
• Enter that value in the input field mentioned above ("max ADC input voltage").
Note  You can use the 'technical' notation like 20m (m=milli) instead of 0.02 in this field. After clicking "Apply", SL will convert the entered value into the default format.

Typical values for software defined radios (giving values for soundcards is pretty useless here, because those figures will always depend on the ever-changing soundcard settings):

• SDR-IQ near 1 MHz, bw=50 kHz, RF gain +10 dB, IF gain +24 dB : Vin_peak_max = 22 mV (*)
• SDR-IQ near 1 MHz, bw=50 kHz, RF gain +0 dB, IF gain +24 dB : Vin_peak_max = 58 mV (?)
• SDR-IQ near 1 MHz, bw=50 kHz, RF gain -10 dB, IF gain +24 dB : Vin_peak_max = 172 mV
• SDR-IQ near 1 MHz, bw=50 kHz, RF gain -10 dB, IF gain +18 dB : Vin_peak_max = 346 mV

(*) Peak values measured with a TDS 210 oscilloscope with 1:1 probe, using the scopes "Pk-Pk" measurement, divided by two.
(?) - Check this: 20 * log10( 58 / 22 ) = 8.4 dB ;  20 * log10( 172 / 58 ) = 9.4 dB . Either the author's measurements, or the preamp gain is inaccurate...