Simply listen to an FM broadcast station using RTL-SDR
Building on my previous post of listening to radio by re-streaming it as a compressed stream, here is a simpler way of encoding the audio straight to your computer’s speakers”
You’ll need to install ‘RTL-SDR’ (as before) and also ‘sox’.
From Ubuntu and similar linux distros, the command is:
sudo apt-get install sox
For Apple Mac install MacPorts (or Brew, another popular Mac installer) then: Macports: sudo port install rtl-sdr sox Brew: brew install rtl-sdr sox
…or if you already have rtl-sdr for use in my previous post, simply use: Macports: sudo port install sox Brew: brew install sox
Once installed, listen to BBC Radio 4 in Brighton on 94.5 MHz (or change to your favourite local station!) by using this command:
rtl_fm -f 94.5M -M fm -s 170k -A fast -l 0 -E deemp | play -r 170k -t raw -e s -b 16 -c 1 -V1 -
RTL_FM receives the radio as before, and play (part of sox) uses these parameters:-r 170k<= This tells sox to receive the stream from RTL_FM at 170Kbps, matching RTL_FM’s -s 170k bandwidth parameter.-t raw<= This denotes a raw input stream, not a file-e s<= encoding; in this case ‘s’ for ‘signed integer’, part of the raw stream.-b 16<= Number of bits in each audio sample-c 1<= a single audio channel (not stereo, because RTL_FM does not decode stereo FM signals)-V1<= ‘verbosity level’ – causes sox to display details about playback –<= Read the stream from stdin (piped from RTL_FM’s stdout using the vertical | symbol).