Tool 05

Signal Generator

A function generator on the computer's headphone or line output, live: two independent channels on left and right, each a sine, square, triangle, ramp, DC or noise, with an optional AM or FM by a second waveform. The frequency goes as high as the sound card's sample rate allows, a frequency sweep steps through a range slowly enough to check a filter with a multimeter, and a scope shows what is being sent.

01

Output

not started
Sample rate in useunknown until started (48 kHz assumed)
Highest frequency the output can hold24 kHz (half the sample rate)
Output latency reportedunknown until started

Browsers open the audio output only after a click, hence the button. The rate shown is what the browser runs at; a request the hardware cannot meet is resampled by the browser, and nothing above the hardware's own half rate survives that. The rate can only be chosen before the first start; reload the page to change it afterwards.

02

Channels

left and right, independent
L

Left channel

0.0 kHz 0.2 kHz 24 kHz
Modulation: none
R

Right channel

0.0 kHz 0.2 kHz 24 kHz
Modulation: none

Amplitude and offset are fractions of full scale (1 = 0 dBFS, the loudest the output can produce; what that is in volts depends on the sound card and the volume setting, usually around 1 V peak at maximum). Square, ramps and triangles are anti-aliased so they stay clean at high frequencies; "ideal edges" switches that off.

03

Frequency sweep

check a filter with a multimeter
stopped 24 steps from 100 Hz to 20 kHz

The sweep plays a sine at the amplitude set for the channel, whatever its shape, and replaces the channel's frequency until it stops.

Readings

At each step, the AC voltage at the filter's input and at its output go in the two columns, both read with the same meter on the same range (in volts, or any unit used for both). The gain is output over input, so the meter's own fall-off with frequency and the sound card's cancel out. A single input reading, given once below, stands for every step left blank.

FrequencyInputOutputGain
100 Hz
125 Hz
160 Hz
200 Hz
250 Hz
315 Hz
400 Hz
500 Hz
630 Hz
800 Hz
1 kHz
1.25 kHz
1.6 kHz
2 kHz
2.5 kHz
3.15 kHz
4 kHz
5 kHz
6.3 kHz
8 kHz
10 kHz
12.5 kHz
16 kHz
20 kHz
  • A multimeter reads AC correctly only over a limited band, written in its manual as the frequency range of AC volts: often 40 Hz to 400 Hz or 1 kHz on a basic meter, 10 kHz to 100 kHz on a true-RMS one. Past it the reading falls whatever the filter does. Reading the input and the output at every step cancels most of that, as long as the reading stays well above the meter's last digit.
  • Each step should last long enough for the meter to settle, about 2 to 3 s for most meters. With Next by hand, a step lasts as long as the reading takes.
  • The sound card stops near 20 kHz, so a filter above that (a 30 to 60 kHz band-pass, a 50 kHz carrier) needs a real function generator; its sweep is the same idea.
04

Scope

what the output is sending
left right 3.00 ms across, triggered on 1 kHz, vertical is full scale output stopped
05

What a sound card can and cannot do

  • The digital limit is half the sample rate: 24 kHz here. The analog output adds its own: the reconstruction filter and the output stage of a typical card roll off above about 20 kHz whatever the sample rate, so a tone set to 30 kHz at 96 kHz may come out much weaker than expected, or not at all.
  • Outputs are AC-coupled. A DC offset, or the DC shape, is produced in the digital signal but a capacitor in the output path removes it before the jack, and very low frequencies (under about 20 Hz) are attenuated the same way.
  • The output is a line or headphone level, a volt or so at most, from an impedance of a few ohms to a few tens of ohms. For a circuit that needs more, an amplifier stage follows; for a carrier above the audio band, a real function generator is the right instrument.
  • The same shapes and modulation can be rendered to a file, with a music track as the modulating signal, in the Stereo L/R tool.