Spectrum Lab's Test Signal Generator

Spectrum Lab is more than a simple audio analyzer. It has a built-in audio signal generator with the following features:

This chapter contains:

The test signal generator can be activated either from Spectrum Lab's main window or the Component Window: The output of the generator can be added to the input of the processing chain, but also to the output (to test external devices). If you need a generator with I/Q-output, let the signal run through the FFT-based filter (which can turn normal signals into complex signals, and remove the "negative" frequencies in the spectrum if necessary).

See also:  circuit window overview ,   main index ,  sample applications .


Generator function blocks

Three independent audio frequencies may be generated WHILE the audio input of the sound card is analyzed. Each of these "tones" can be adjusted from 0.1 Hz to 2000.0 Hz in 0.1Hz-steps. By setting a tone's frequency to zero you turn it off (so you can use this generator also for one-tone- and two-tone- tests).

The three sine waves are calculated in real-time using the PC's floating point unit, so you need a fast CPU if you want to generate these tones WHILE analyzing the input. The generator can be started from the "View/Windows" menu.

The signal generator also has an adjustable noise generator (white noise). This is a useful tool for testing filters. You may test the "software"-filter of SpecLab with this generator, but you may also test a "real" filter with it if you connect the signal generator to the sound output and the spectrum analyzer to the sound input (look at the component window for details).

back to top


Generator Control Window

The signal generator's control window can be opened from Spectrum Lab's main window, or by clicking on the generator block in the test circuit diagram.

Here are just some of the generator controls:

back to top


Arbitrary Waveform Generator

Each of the signal generators -also the AM+FM modulators- can be switched to "arbitrary waveform" mode. The arbitrary waveform is stored in array with 1024 sample points, from where it can be read out in any desired speed (using interpolation). To define the waveform, you can ...

To fill the arbitrary waveform table with calculated values, enter a numeric formula in the edit field on the right side of the graphic waveform display. The formula will be evaluated by SpecLab's numeric interpreter. The variable 'x' runs as index from 0 to 1 over the whole array (regardless of the actual length of the array; so you can say that 'x' is the array index "normalized" to 0 ... 1). To use 'x' in an argument of the trigonometric functions like sin and cos (sine and cosine), 'x' must be multiplied with 2 * pi ( pi is a constant, approx. 3.14159265...) .
The result of the formula must be in the range +/- 1 . Some examples :

Expression ("formula")

Result

sin(2*pi*x)

fills the waveform table with a pure sine wave

(x<0.5)

fills the table with a pulse, 50 percent duty cycle

(x<0.1)

fills the table with a pulse, 10 percent duty cycle

(x<0.1)+0.01*((x>0.5)&&(x<0.6)) produces a "strong", followed by a "weak" pulse

(1-x)*sin((5*(1-x))^4)

"Starwars"-like sound (laser) when played at 5 Hz .
Taken from CrazyBirds1.usr, a nonsense-audio-generator

rand()

fills the waveform table with white noise

back to top


Controlling the generator via interpreter commands

There are a few commands and functions in Spectrum Lab's interpreter which can be used to control the signal generator. They can be used to control the generator from an external program, etc.
To set a new value, use a formal assignment like "generator[0].freq=123.4".
The token "generator" can be abbreviated as "gen" if necessary.

generator[N].ampl
Reads or sets the amplitude of one of the three function generators (N=0..2) on a linear scale.
generator[N].freq
Reads or sets the frequency of one of the three function generators (N=0..2) in Hertz.
generator[N].level
Reads or sets the amplitude of one of the three function generators (N=0..2) on a logarithmic scale, the unit is decibels (dB), 0 dB is the clipping point.
generator.on = 1
turns the signal generator on (applies to all channels)
generator.on = 0
turns the signal generator on (applies to all channels)

back to top


Background Notes

The author used this generator to find out how "linear" his "linear transverter" for 136kHz really was by feeding it with a two-tone signal and analyzing the transmitted spectrum at the same time. A simple two-tone test is also good for testing the intermodulation of receivers or single amplifier stages.

It was later used in a 'confidence test' for some of Spectrum Lab's spectrum analysis functions (using the FM modulator to spread the energy from a sine generator, without changing the total power).

Tech notes, something to test:

back to top