A Simple Receiver
Here the pieces become a radio. This
chapter builds the classic receiver
chain — take one station out of a wide
recorded band, move it to the centre,
keep only its slice, read its message
out — and runs it, end to end, on a
recording. The recording is synthetic
(gnu-radio-lab/make_recording.py made
it, and its spectrum confessed it in
chapter 10), which is a strength, not
an apology: a receiver that cannot find
a signal whose every number is known
has no business hunting unknown ones.
The transcript is
gnu-radio-lab/transcripts/t03-receiver.txt;
the chain is gnu-radio-lab/fg3_receiver.py.
The station we planted
One second of complex samples at 240,000 per second — a 240 kHz-wide slice of imaginary spectrum. At +15,000 Hz inside it sits a carrier, amplitude 1.0, amplitude-modulated: its strength wobbles 700 times a second, between 0.5 and 1.5, the way a voice or a tone wobbles an AM transmitter. The wobble is the programme. Everything else in the 240 kHz slice is, for this lesson, empty — one station, no neighbours, no noise: the receiver's exam has one question on it, deliberately.
The chain, block by block
- File source reads the recording. This is the honest stand-in for a dongle: the same samples, the same rate, replayable forever. Chapter 7 said what a file does not carry — the rate and the tuning — so the graph states them: 240,000 in, station at +15,000.
- Frequency-translating FIR filter
(
freq_xlating_fir_filter_ccc) does chapters 8 and 9 in one block, in the only safe order. First it mixes: multiply the stream by a steady tone at −15,000 Hz, which slides every signal in the band down by 15,000 — the station lands at 0, the centre, its arrow (chapter 2) now turning in place, its wobble intact. Then it filters: the low-pass of chapter 8 (cutoff 6,000 Hz, 289 taps) keeps the station's slice and discards the rest of the 240 kHz. Then it decimates by 5, the filter's own arithmetic skipping the rejects: 240,000 → 48,000 samples a second, because everything that needed the old rate has already been removed. - Complex to magnitude
(
complex_to_mag) is the demodulator, and for AM it is disarmingly simple: the message was written onto the signal's strength, so read the strength — chapter 2's arrow length, sample by sample. Out comes a real stream: the wobble, plus a steady level from the carrier itself.
A speaker would take it from there (the steady level removed, the rate changed to an audio card's); the lab ends in a file sink instead, to measure rather than to listen.
The verdict, measured
samples: 48000
value: mean 0.9994, max 1.5857, min 0.0002
strongest frequencies (Hz):
700.0 magnitude 11955.5
48,000 floats — the right count for one second at the new rate. The mean, 0.9994 ≈ 1.0, is the carrier's steady contribution, as planted. The strongest frequency in the output is 700 Hz, the test tone, at magnitude 11,955.5 against a predicted 48,000 × 0.5 ÷ 2 = 12,000. The receiver found the station, centred it, and read its programme back at the frequency the programme was written at. The max of 1.5857 against a planted peak of 1.5 and a minimum of 0.0002 are the chain's fingerprints, not errors: the translating filter's startup transient (chapter 6 met its cousin) — the output climbs from nothing as the filter's window fills, and overshoots once before settling — visible in the file because the lab measured the file.
What generalises
Every real receiver in this toolkit is this chain with the costumes changed: a different thing read off the signal at the end (the arrow's angle for FM, its symbols for digital modes), a sharper or wider filter in the middle, gain stages and squelch around it, a dongle where the file was. The shape — tune, select, demodulate, at falling rates — does not change. When a receiver misbehaves, the shape tells you where to stand with chapter 7's file sink and measure what is actually there: before the mixer, after the filter, at the output. Three taps, three files, and the broken stage has nowhere left to hide.
Check: state, before running
anything, what the output's strongest
frequency and mean would be if the
planted tone had been 300 Hz at depth
0.25 — 300 Hz, mean still 1.0, peak
magnitude 48,000 × 0.25 ÷ 2 = 6,000.
make_recording.py takes its numbers
from the top of the file; change them,
re-record, re-receive, and grade
yourself against the measurement.