Virtual test equipment: computer audio signal generation tools

plot of sin(x) from -2pi to 2pi using gnuplot

Your computer and sound card can be used in lieu of some pieces of test equipment, particularly audio equipment. A couple times in as many weeks, I have needed to generate tones to send over the radio.

Most of the tools described here run on Linux; most are also available on Mac OS X, Windows, FreeBSD, etc.


Sox is a cross-platform command line program to perform various transforms on audio files and it can also play, record, and synthesize audio. It has programs named sox, play, and rec. Many of the transforms related to audio file format conversion but it also can do sound effects including lowpass, bandpass, bandreject, pitch bend, bass/trebble, equalizer, biquad IIR filter, FIR filter, chorus, companding (dynamic range compression), dc offset, compact disc deemph, delay, dithering (add small amounts of noise), headphone filter, echo, fade, flanger, gain, gain normalization, volume control, any LADSPA plugin, loudness, noise profiling, noise reduction, overdrive, silence padding, phaser, resampling, mixing, repeat, reverberation, reversing, riaa (vinyl) filter, silence removal, sinc filter, spectrogram, speed changes, audio splicing, statistics, swap stereo channels, stretch, tempo, tremolo, and voice activity detector.

It can synthesize sine, square, trinagle, sawtooth, trapezium, exp, white noise, tpdfnoise, pink noise, brown noise, and pluck.

# Install
sudo apt-get install sox

# Generate 10 seconds of 500Hz sinewave at 0dB gain.
play -n synth 10.0 sine 500.0 gain 0.0

# generate 10 seconds of sweep from 100Hz to 4000Hz
play -n synth 10.0 sine 100-4000 gain 0.0


You probably already new that fldigi could generate and decode a variety of ham radio digital modes. It turns out it can be used as a primative tone generator as well.

Define a macro button like this

And when you hit the macro button, it will generate 10 seconds of 500Hz.  If you leave off the GOFREQ command, then it will generate a tone corresponding to the center frequency slider on the waterfall. 

Fldigi also functions as an audio spectrum analyzer, with spectum plot or waterfall, and a very primative audio oscilloscope.   fldigi can be directly wired or, with some loss of fidelity, accoustic coupled.   If you have a microphone on your computer, you can simply have the mic sitting on the table near your radios.


Audacity is a GUI audio editing program (non-linear editor, recording studio). It also has the ability to synthesize some sounds: chirp (swept amplitude/frequency), DTMF (touch tones), sine, square, sawtooth, white/pink/brown noise, click track (metronome), plucked string, and drum. Linux, Mac OS X, windoze. sudo apt-get install audacity audacity-data audacity


sudo apt-get install flite Flite is a speech synthesizer. As usual, you may need to massage the text a bit to get good results. flite -t "CQ CQ CQ this is A K 4 O L alpha kilo 4 oscah leema over" Linux, Mac OS X, Windows 2000/XP with cygwin, FreeBSD,Solaris, PalmOS, WinCE, Windows Mobile Windows executable:


Actually, this is just a piece of linux specific glue. Some of these programs use the obsolete /dev/dsp sound card interface. By prepending "padsp" (for pulse audio based systems) or esddsp (older enlightenment sound daemon based systems) before the command, it will be run in an environment where accesses to /dev/dsp will be intercepted and sent to the sound daemon.


sudo apt-get install siggen Ncurses based (terminal user interface). Generates 0,1, or 2 tones of sine, cosine, square, triangle, sawtooth, pulse, and noise. Requires padsp" padsp siggen


multimon can decode AX.25 (amateur packet radio), POCSAG (paging), DTMF, ZVEI (german paging) and provides a rudimentary oscilloscope. The enclosed gen program is handy for generating DTMF tones and can also encode sine waves (no control over duration) and hdlc packets. Linux specific, but multimonNG runs on Windoze and Mac OS X but executables are not provided. 500Hz tone of amplitude 1.0, duration not controllable: padsp gen -s 500 -a 1.0 Send touch tones: padsp gen -d 895A10

A sample script

This script requires you have bash. This is standard on linux and Mac OS X and is available on windoze if you install cygwin. It uses sox and flite. It plays on the default sound device (computer speakers).

# use play command from sox package.

# play -n synth 0.2 sine 500.0 gain -10 

flite "500 hertz at different volume levels"
flite "watch 1500 hertz for third harmonic indicating clipping or non-linearity"
for i in -10 -9 -8 -7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 8 9 10; do
  echo -- "$idB"; 
   echo "${i}dB" | sed -e"s/-/minus /" | flite
  play -n synth 1 sine 500.0 gain $i

flite -t "sweep 100 hertz to 4000 hertz" 
play -n synth 10.0 sine 100-4000 gain -4dB

for ((i=100;i<=4000;i+=100)); do 
  echo "$i hertz"
  flite -t "$i hertz"
  play -n synth 1 sine $i gain -4


sudo apt-get install stk stk-doc
Simulates musical instruments.
Might be useful when you want to generate a particular harmonic structure.


xoscope is a sound card based oscilloscope.

Other software oscilloscopes that are not packaged for ubuntu linux include : osqoop, glscope,philoscope, scope, SAA, dataguzzler.

sudo apt-get install xoscope


sox can be used to transform an audio file into an ascii number stream that can be parsed by gnuplot.

gnuplot can also be used to plot arbitrary functions and data. The sinewave at the head of this story was generated using:

set xrange [-2*pi:2*pi]
plot sin(x)
set terminal png size 320,240
set output "sinewave.png"
set output
set terminal x11

Bessel Null FM Deviation measurement

If you transmit an audio tone of the FM deviation divided by 2.4, the central carrier will magically disappear. This can be seen on a spectrum analyzer (including an RTL-SDR or an uncalibrated analyzer) or even a CW receiver.

Sound Card LCR meter

No version for real operating systems, yet.

There are some projects on the net to make sound card LCR meters. These measure inductance, capacitance, and resistance of electronic components. Typically, these circuits use a couple op amps, though one just uses a few resistors.
One version is €10 ($13) Windows shareware. The Elektor resistor only version is Java based (you need to create an account on their website to download) but it needs a windoze DLL.


Gnuradio-companion is a program that lets you graphically patch together different digital signal processing modules. This can include tone generators, modulators, demodulators, mixers, filters, frequency translators, etc. It is possible to process data with gnuradio, such as to construct an HF receiver with audio demodulator, then pipe the audio through ALSA virtual audio devices, and then digitally demodulate using FLDIGI, or do the reverse.


gqrx is a primitive software define radio based on gnuradio. It works with the RTL-SDR modules, among others. Supports: Funcube Dongle, RTL2832U SDR, USRP, OsmoSDR and HackRF.


Quisk is another SDR program. Doesn't support the RTL-SDR yet but it does support some other SDRs. It can be used as an audio spectrum analyzer/oscilloscope.


Modulate digital voice using codec2 and 16QPSK.

Some linux sound tricks

You might need to send output to a USB sound card other than the default device.

To see the names of pulse audio input and output streams:
pacmd list-sinks |grep "Name:"
pacmd list-sources | fgrep "name:"
pactl list | fgrep "Name:"
To see alsa streams:
aplay -l
arecord -l
But this doesn't give you the names such as "default" and "hw:0,0" though the later form can be derived from the listing.

In ubuntu 12.04 sox is compiled with alsa support but not pulseaudio. The AUDIODRIVER and AUDIODEV environment variables can be used to set destination.
AUDIODRIVER=alsa AUDIODEV=hw:0,0 play -n synth 10.0 sine 100-4000 gain 0.0

Plugging in the samson Q2U microphone (which also has a headphone jack) can cause the default audio output to be redirected to those headphones. In Pavucontrol, Configuration -> Samson Q2U Microphone -> Profile: Analog mono input will switch back to speakers, but this isn't very clean. You can use the sound settings (click on the speaker icon near screen top right) and select the default output device.

On acer aspire one 532h netbook, the regular volume control doesn't work properly with the built in microphone. Use pavucontrol instead (sudo apt-get install pavucontrol).


Tonetool is a J2ME Midlet that runs on J2ME cell phones (such as Brew OS, rumor touch, rumor reflex, sanyo PM-8200?, nokia, other non-smart phones, etc). It is rather primative in that it generates the waveform and then plays it. We actually used this recently to generate 1Khz test tones at the Marshal Manor repeater site. It generates DTMF tones, 1750Hz tones, and custom tones.


This covers a small subset of SDR related hardware.

  • Samson Q2U XLR/USB microphone with full muff headphones
  • USB sound cards - provide extra input/output for SDR, signal generation, oscilloscope, etc. Beware that the cheap tiny usb dongles usually have poor mono audio inputs. ADS Technologies RDX-150-EF is a basic sound card with stereo in/out at a cheap price. Sound cards that provide more than 48Khz sample rate (higher sample rates desirable but not necessary for SDR) and stereo in/out are scarce and expensive.
  • Ham It Up - HF to 2m up converter or 2M to HF down converter. As a downconverter, you can use it to monitor your 2m transmitter on a 50Mhz digital storage oscilloscope.
  • UHFSDR - almost DC to 700Mhz transceiver. Partial kit (though W6ARH will sell a full kit for around $200). It is another $85 for the switched bandpass filter board. You will also need a USB controller to run I2C bus to set oscillator frequency, a power amplifier, and a USB sound card.
  • Peaberry SDR transceiver (1W QRP). Like a softrock with built in USB sound card. $150 Kit 160/80/75m, 80/75/60/40m, 60/40/30/20m, 30/20/17/15m, or 17/15/12/10m band combinations. 10m band missing. Want more bands? Build more than one. Two will cover 80/75/60/40/30/20/17/15m.
  • Funcube Dongle. $200 price range SDR receiver as a USB dongle. Has bandpass filters. 150kHz to 240Mhz and 420Mhz - 1.9Ghz
  • RTL-SDR. Current version covers 24-1766 MHz without a gap. Use a Ham It Up or other upconverter to process HF. These are DVB-T (European Digital Televison) receivers that have been repurposed as SDR receivers. Only 8 bit sampling and no band filters. NooElec on ebay is one vendor. These are DVB-T (European Digital Televison) receivers that have been repurposed. Cost under $20. Don't forget to order an adapter to the weird DVB or MCX connectors to BNC. Prone to desense due to 8bit conversion and lack of bandpass filters. Dependong on software, it can receive AM/FM/USB/LSB/CW, FM stereo broadcast, weather channels, P.25 (digital police/fire), ADS-B (1090Mhz aircraft location transponder broadcasts), TETRA, GMR, GSM, POCSAG (Paging), AIS (ship location transponder broadcasts), and wireless temperature/weather sensors. Has been used in conjuction with Raspberry-Pi in some applications.
  • FlexRadio Systems

Leave a Reply