English · Español
Version 1.0.0 · KqK.cl
Turns an RTL-SDR dongle into an internet FM radio: it tunes stations on the FM band, decodes them in stereo and streams them as MP3 to a web player, with an admin panel to change stations, broadcast several at once and see who is listening.
- Public web player: play/stop, volume, station name and the song that is playing (with cover art), and a list of live stations to choose from. Works on phones, with lock-screen controls.
- Multi-station: broadcasts up to 6 stations at once with a single dongle, as long as they fit in the same 2 MHz block of spectrum.
- Band scan: sweeps 87.5–108 MHz, picks the best gain for the dongle and detects the stations you can receive, with their signal quality. Useful at install time or after moving the antenna.
- Song recognition for every station that has listeners (via ShazamIO).
- Listener log: start time, duration, IP, station, device and data transferred; who is online right now.
- Embed in another page (WordPress or any site): the admin generates the player code, with a fixed station or a list, dark or light colors and automatic height.
- Interface in English or Spanish. Login with attempt limiting and optional Cloudflare Turnstile.
- Lightweight: 5 stations at once use about one CPU core (tested on an ordinary x86 PC).
More screenshots (tuner, settings, phone)
![]() Admin: tuner, multi-station and listener log |
![]() Settings: gain, band scan and embed code |
![]() Player on a phone |
IP addresses in the listener log are fictitious.
- Requirements
- Installation
- First steps
- Publishing it on a domain (reverse proxy)
- Embedding the player in another page
- Configuration (.env)
- How it works
- Maintenance
- Troubleshooting
- Security
- Legal notice
- Credits and third-party software
- License
- An RTL-SDR dongle with an R820T/R820T2 tuner (tested with the RTL-SDR Blog V3) and an FM antenna (a dipole with ~75 cm arms, or the telescopic antenna that comes with the kit, works well).
- A Linux server with Docker and Docker Compose (v2), with the dongle plugged in over USB. Tested on Ubuntu 24.04 (x86-64).
- CPU: a fraction of a core for one station; ~1 core for 5 at once.
- Internet access for song recognition.
Nothing else has to be installed on the host: the user-space driver (librtlsdr) lives inside the container.
git clone https://github.com/r34lcl/Radio-FM.git
cd Radio-FM
cp .env.example .env
nano .env # passwords, admin user and initial frequency
docker compose up -d --buildTo generate passwords and the session key: openssl rand -hex 24.
The first build takes a few minutes (it compiles airspy-fmradion). Then open:
- Public player:
http://<server>:8080/ - Admin:
http://<server>:8080/admin
Check that everything started with docker compose logs -f tuner: you should see the dongle being opened
and the station going on air.
- Log in to the admin and go to Settings → Band scan → Scan now. The radio stops for about a minute while gains are tried and the band is swept.
- Review the result: recommended gain and detected stations. Press Apply results.
- In Tuner, pick a station from the list (the bars show signal quality) and name it with Save name. The name shows up in the public player and in the stream metadata.
- Multi-station: select other nearby stations (within 2 MHz of the main one) to broadcast them at the same time. The public player then shows the list so each listener can choose.
- If a station has 1 signal bar, try Mono: it sounds much less noisy.
The web language (including the public page) is changed with the ES / EN selector in the admin.
To use it from the internet over HTTPS, put it behind a reverse proxy (Nginx Proxy Manager, Caddy,
Traefik, nginx…) pointing to http://<server>:8080, and set in .env:
COOKIE_SECURE=true # the session cookie only travels over HTTPS
TRUST_PROXY=true # take the listener's real IP from X-Real-IP / X-Forwarded-ForThen docker compose up -d. With nginx, disable buffering for the audio (the web already sends
X-Accel-Buffering: no, which nginx honors):
location / {
proxy_pass http://127.0.0.1:8080;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_buffering off;
proxy_read_timeout 1d;
}With TRUST_PROXY=true, do not expose port 8080 directly to the internet: anyone could fake their IP.
In that case change the port in docker-compose.yml to "127.0.0.1:8080:8080".
Cloudflare: Cloudflare's proxy is not meant for continuous audio streaming (their terms limit it). Use the domain in "DNS only" mode (grey cloud) or your own proxy.
In Settings → Embed in another page choose the station (all or a fixed one), colors, language and
whether the height adjusts automatically; then Copy code and paste it on your site. In WordPress: a
Custom HTML block. Only the /embed path can be shown inside other pages.
For outside visitors to see it, the radio must be reachable from the internet (section 4). Listeners who come from an embedded player appear in the listener log tagged "via site".
| Variable | Default | Description |
|---|---|---|
FREQ |
— | Initial frequency in MHz. Afterwards, what is chosen in the web wins. |
GAIN |
auto |
Dongle gain in dB. Best chosen with the band scan. |
STEREO |
1 |
1 stereo, 0 mono. |
BITRATE |
192k |
MP3 bitrate. |
DEVICE_INDEX |
0 |
Which dongle to use if there are several. |
ICECAST_SOURCE_PASSWORD / ICECAST_ADMIN_PASSWORD |
— | Internal Icecast passwords. |
ICECAST_MAX_CLIENTS |
20 |
Maximum simultaneous listeners. |
ICECAST_PORT |
8010 |
Icecast port, on 127.0.0.1 only. |
WEB_PORT |
8080 |
Web port. |
WEB_USER / WEB_PASSWORD |
— | Admin username and password. |
SESSION_SECRET |
— | Key used to sign sessions. |
COOKIE_SECURE |
false |
true when served over HTTPS. |
TRUST_PROXY |
false |
true behind a reverse proxy. |
LISTENER_LOG_DAYS |
90 |
Days the listener log is kept. |
TURNSTILE_SITE_KEY / TURNSTILE_SECRET_KEY |
empty | Cloudflare captcha on the login page (optional). |
SONGID_INTERVAL |
45 |
Seconds between song identifications per station. |
Whatever is changed from the web (station, extra stations, mono/stereo, gain, names, language) is stored
in the state/ folder and takes precedence over .env.
┌───────────────── "tuner" container ─────────────────┐
antenna ─► RTL-SDR ─USB─►│ one station: airspy-fmradion ─► ffmpeg (MP3) ───────┼─► Icecast ─► web ─► listeners
│ several: rtl_sdr ─► channelizer.py ─► airspy-fmradion │ │
│ (1 FFT, N channels) × N ─► ffmpeg │ └─► songid (Shazam)
└──────────────────────────────────────────────────────┘
- tuner:
tuner.shreads the tuning chosen in the web (state/plan) and starts the pipeline. With one station, airspy-fmradion reads straight from the dongle. With several,rtl_sdrcaptures a 2.304 MHz block andchannelizer.py(NumPy, overlap-save fast convolution) splits each station into its own 384 kHz channel, decoded by one airspy-fmradion instance each. Every station is encoded with ffmpeg and published on Icecast as/fm<frequency>.mp3(e.g./fm981.mp3). It also runs the band scan (scan.py). - icecast: internal streaming server.
- web:
web/app.py(Python standard library only). Serves the player and the admin, and relays the audio from Icecast to listeners, which is what makes the listener log possible. - songid: every so often it takes a few seconds of audio from each station with listeners and
identifies it with ShazamIO. It is optional: if you don't want it, don't start it
(
docker compose up -d icecast tuner web).
- Update:
git pull && docker compose up -d --build. - Backup: the
state/folder (stations and names, tuning, listener log) and.env. - Logs:
docker compose logs -f tuner(radio),web,songid. - Moved the antenna or the equipment: run a new scan in Settings. "Same location" keeps the names; "New location" clears them (the frequencies may belong to other stations now).
| Symptom | What to do |
|---|---|
usb_claim_interface error -6 |
Another program is using the dongle, or the kernel loaded the DVB-T driver. On the host: echo 'blacklist dvb_usb_rtl28xxu' | sudo tee /etc/modprobe.d/rtlsdr.conf, then unplug and replug the dongle. |
No supported devices found |
Check lsusb (it should list Realtek RTL2838) and that the container sees /dev/bus/usb. |
| Noisy or hissing audio | Weak signal: try Mono, improve the antenna position, or run the scan to adjust the gain. |
| Distorted audio | Gain too high (the dongle saturates). Run the scan or lower the gain. |
| An extra station can't be selected | It doesn't fit in the same 2 MHz block with the others, or there are already 6. |
| The embedded player doesn't load outside your network | The radio isn't reachable from the internet (see section 4). |
| Songs aren't recognized | Needs internet; talk, ads and obscure music aren't always identified. |
- Use long passwords in
.envand never commit it to any repository (it is in.gitignore). - The login limits attempts per IP; with
TRUST_PROXY=truethe IP comes from the proxy, so the web must not be reachable without going through it. - The admin sends
X-Frame-Options: DENY; only/embedcan be embedded in other sites. - The listener log stores IP addresses: if you run it publicly, consider your country's personal data
regulations and adjust
LISTENER_LOG_DAYS.
- Rebroadcasting stations over the internet may require permission from the stations or from the copyright collecting societies of your country. This project is meant for personal use or use with permission; whoever installs it is responsible for how it is used.
- ShazamIO uses an unofficial Shazam API. This project is not affiliated with Shazam or Apple, and that service may stop working at any time.
- Song cover art and metadata belong to their owners.
Radio FM builds on these projects (thanks to their authors). This repository does not include their code: the Docker images download and install them at build time, each under its own license.
| Project | Used for | License |
|---|---|---|
| airspy-fmradion (Kenji Rikitake, JJ1BDX; based on SoftFM by Joris van Rantwijk and NGSoftFM by Edouard Griffiths, F4EXB) | Stereo FM decoding | GPL-3.0 |
| rtl-sdr / librtlsdr (Osmocom) | Dongle access | GPL-2.0 |
| Icecast (Xiph.Org) | Streaming server | GPL-2.0 |
| FFmpeg | MP3 encoding (LAME) | LGPL/GPL |
| NumPy | Channel splitting and band scan | BSD-3-Clause |
| ShazamIO | Song recognition | MIT |
If you distribute an already built Docker image, you also distribute those programs and must comply with their licenses (in particular, offering the source code of the GPL components).
Radio FM is distributed under the Apache License 2.0. You may use, modify and redistribute it; every copy or derivative work must keep the NOTICE file, stating that it is based on Radio FM by KqK.cl.



