Skip to main content

Module fm

Expand description

Frequency modulation (FM) and demodulation of complex baseband signals.

In FM the message m[n] sets the instantaneous frequency of a constant-envelope carrier: f[n] = k_f · m[n] Hz, so the baseband signal is y[n] = e^{jφ[n]} with φ[n] = 2π Σ_{i≤n} f[i] / fs. The peak deviation is k_f · max|m|, and Carson’s rule estimates the occupied bandwidth as 2 (Δf + f_m).

The modulator accumulates phase in the same fixed-point Nco used by the signal sources, so the phase never drifts, however long the stream runs. The demodulator is the classic quadrature (phase-difference) discriminator arg(y[n] · conj(y[n-1])), which needs no carrier recovery and recovers the message exactly in the absence of noise, as long as the deviation stays below fs / 2. An optional single-pole de-emphasis filter models the broadcast treble-boost compensation.

See the book entry Modulation: constellations, OFDM and FM.

Structs§

FmDemodulator
A streaming quadrature FM demodulator: complex baseband in, recovered message out.
FmModulator
A streaming FM modulator: real message samples in, unit-amplitude complex baseband out.

Functions§

carson_bandwidth
Carson’s rule for the bandwidth (Hz) containing nearly all of an FM signal’s power.
fm_demodulate
Demodulates a whole baseband record (no de-emphasis). k_f is the modulator’s sensitivity.
fm_modulate
Modulates a whole message: k_f in Hz per message unit, sample_rate in Hz.