An implementation of a FM demodulator that supports
- Mono audio using L+R signal
- Stereo audio using L-R signal
- RDS decoding
As much of the internal state of the demodulator is shown for academic purposes. This program is intended to be an educational tool.
SIMD is employed to improve DSP performance on x86 processors.
- Setup rtlsdr radio drivers according to here
- Plug in your RTLSDR Blog v3 dongle
- Download program from releases page.
- Unzip and extract folder.
- Run
./fm_demod_tuner.exe
FM radio contains many data components which are present after FM demodulation.
Frequencies | Description |
---|---|
0 - 15kHz | L+R audio |
19kHz | Pilot tone |
38 ± 15kHz | L-R audio |
57 ± 2kHz | RDS (radio data system) |
To compensate for frequency and phase offsets due to errors in the receiver or transmitter we need to lock onto the pilot tone. This is done with a PLL.
To downconvert the L-R and RDS signals we use harmonics of the PLL output. The L-R signal is downconverted using the second harmonic, and the RDS signal is downconverted by the third harmonic. In an analogue circuit this can be easily done by squaring the 19kHz PLL output and filtering out the desired harmonics from the square wave.
Stereo audio can be generated by combining the mono L+R audio with the L-R audio.
L = (L+R) + (L-R) = 2L
R = (L+R) - (L-R) = 2R
The RDS signal is a binary phase shift keyed signal. This is passed through a BPSK symbol synchroniser to get constellation points in the range of -1 to 1.
The RDS signal contains the following data described here.
The document used to decode the standard (partially) is located here.
It usually contains the programme identifier code and additional descriptive text and metadata.
- Download FM signal recording from here.
- Extract
*.pcm
from archive - Download program from releases page
- Run
./fm_demod_no_tuner.exe -i <recording>.pcm
The release binaries are compiled against AVX2 which should be available on most modern processors. However if your CPU doesn't have these instructions, you may get an Illegal Instruction
error when you run it in the terminal.
Follow ./toolchains/*/README.md
to compile for your CPU.