Code Monkey home page Code Monkey logo

fm-radio's Introduction

SDR FM Radio Demodulator

x86-windows x86-ubuntu x86-macos

Introduction

An implementation of a FM demodulator that supports

  • Mono audio using L+R signal
  • Stereo audio using L-R signal
  • RDS decoding

Screenshot

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.

Instructions

  1. Setup rtlsdr radio drivers according to here
  2. Plug in your RTLSDR Blog v3 dongle
  3. Download program from releases page.
  4. Unzip and extract folder.
  5. Run ./fm_demod_tuner.exe

Explanation

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)

FM Spectrum

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

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

Radio Data System (RDS)

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.

Running from offline data

  1. Download FM signal recording from here.
  2. Extract *.pcm from archive
  3. Download program from releases page
  4. Run ./fm_demod_no_tuner.exe -i <recording>.pcm

Recompiling for older processors

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.

fm-radio's People

Contributors

williamyang98 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.