Skip to content

About

Android radio for RTL-SDR dongles: HD Radio (NRSC-5) and analog FM with a car-radio style blend. No internet needed.

Topics

Resources

Stars

2 stars

Watchers

1 watching

Forks

 
 

Repository files navigation

HiDef Radio

This fork adds traffic and weather maps and ad image blocking to HiDef Radio by derek20la. The maps are received over the air, with no internet. Download HiDef Radio Maps from the Releases page. It installs alongside the original app.

This fork is actively maintained. Report problems under Issues, and ask questions or share what you receive in Discussions.

Traffic Weather radar
Traffic map received over the air Weather radar animation received over the air

Stations with the Total Traffic Network or HERE data services send these maps. Each one shows the date and time the station made it, right on the picture. The radar plays through about 90 minutes of frames, which are kept for 3 hours across restarts. Maps appear under the signal line while the signal details are closed; on a tablet, tap the Signal details heading to close them. Double-tap a map to fill the screen, with bigger buttons and the screen kept on, which suits a tablet used as a car radio; double-tap again to come back. Map data © OpenStreetMap contributors.

Ad image blocking: stations often send ads as the album art. Hold a finger on the picture and tap Block, and it won't be shown again, even when the station re-sends it. Settings → Clear blocked pictures clears the list. This blocks pictures only; the audio isn't changed.

32-bit build: the Releases page also has a -32bit APK, for older devices such as 32-bit car head units and old tablets.

Android Auto: HiDef Radio shows up in Android Auto's launcher, which gives HD Radio to a car that doesn't have it. The car's screen shows the album art and station logos, the song title and artist, play/pause, ⏮ ⏭ for your favorites, Stop, and an HD button that steps through HD1, HD2 and so on while the station has more than one. Your favorites are listed as tiles to tap and tune, and "Hey Google, play 95.5 HD2 on HiDef Radio Maps" tunes by voice. The traffic and weather maps stay on the phone, since Android Auto doesn't allow pictures like them. The dongle needs the phone's USB port, so use wireless Android Auto, or a USB hub that connects the phone, the dongle and the car (one from Anker works).

To set it up (once, on the phone):

  1. Allow apps from outside the Play Store. Open Android Auto's settings (Settings → Connected devices → Connection preferences → Android Auto, or search Settings for "Android Auto"). Scroll to the bottom and tap Version ten times, then say OK to turn on developer settings. Open the ⋮ menu at the top right, tap Developer settings, and turn on Unknown sources. Without this, Android Auto hides apps that weren't installed from the Play Store.
  2. Put the app on the car's screen. Back in Android Auto's settings, tap Customize launcher and tick HiDef Radio Maps (drag it up the list to put it near the front).
  3. Allow the dongle. Plug in the dongle and start the radio on the phone once, so Android remembers the USB permission. If the car's ▶ doesn't start the radio later, start it on the phone.

Then connect to the car and pick HiDef Radio Maps from the Android Auto launcher.

Phones and tablets: Android Auto works with any phone. On a tablet it works only if the tablet takes a SIM card, because then Android treats it as a phone; the ALLDOCUBE iPlay 50 is one that runs Android Auto. On a Wi-Fi-only tablet, Android Auto may install from an APK, but its settings won't open, or the car refuses it with a message that the app wasn't bundled with the system by the manufacturer (tried on a Samsung tablet and a Lenovo Legion Y700). HiDef Radio Maps itself still runs fine on those tablets, with the full-screen maps, just not on the car's screen. A tablet with a SIM slot gives you both: the album art and controls on the car's screen, and the maps full-screen on the tablet.

Windows version: HiDef Radio also runs on Windows 10 and 11 with the same RTL-SDR dongle: HD Radio and analog FM/AM, album art and logos, the traffic and weather maps with their time stamps, ad image blocking, recording (audio and IQ), favorites and the signal details. Get the installer or the zip from the Releases page. The dongle needs the WinUSB driver, which Zadig installs. It uses the Android app's own radio engine, built for Windows; see windows/README.md.


HiDef Radio: over-the-air FM and digital radio for RTL-SDR dongles

An Android radio for the RTL-SDR dongle. Plug the dongle into the phone with a USB-OTG adapter and listen to HD Radio™ (NRSC-5) and ordinary analog FM, with a smooth blend between the two, like a car radio.

No root, no computer, no internet connection needed (a dongle on another computer over your Wi-Fi works too, since 1.2). Everything you hear and see comes from the antenna: audio, station names, song titles, station logos and album art.

Status: 1.3.1. On Google Play, and an APK is on the Releases page (see Get the app). Developed on a Moto G Stylus 2024 (Android 15) with an RTL-SDR Blog V4 in Los Angeles, and also run on a Pixel 8.

An HD station with its logo, song title and the favorites strip Analog FM with the signal meter, stereo and RDS The signal details

Features

What it receives

  • HD Radio on FM: HD1 and the extra programs (HD2, HD3, HD4 ... up to eight). A button appears for each program the station actually carries.
  • Analog FM in stereo, with a stereo-to-mono blend as the signal gets noisy.
  • RDS / RBDS on analog FM: call letters, program type, RadioText, and song title and artist where the station sends them.
  • HD Radio on AM. It needs a dongle that can tune AM, such as the RTL-SDR Blog V4.
  • Analog AM (since 1.1): a synchronous detector, which is what HD-ready AM radios use, with the same blend to HD as on FM, and C-QUAM AM stereo for the few dozen US stations that still send it, with the NRSC de-emphasis an AM radio uses (a switch in Settings). See Known limits.
  • Band plans for the Americas, Europe and most of the world, Japan and Brazil, each with the right FM de-emphasis (75 or 50 µs).

The blend

  • In the default Auto mode the analog sound starts within a moment of tuning. About ten seconds later the app has measured how far apart the analog and the HD audio are, and how much louder one is than the other, and it crossfades to HD without a skip or a jump in volume.
  • The HD audio is decoded about 2.5 seconds before it is due, so a dropout is known in advance. The blend fades back to analog before the gap and returns once the HD is clean again.
  • It works with cheap and old dongles too. Their crystals can be 50 parts per million off and more, which lets the analog audio creep away from the HD audio by milliseconds a minute. The app measures the dongle's clock against the station's and corrects for it.
  • It also works on stations that run their analog through a very different audio processor than their HD (since 1.2.1; found on KKLQ 100.3 in Los Angeles). The two then match only loosely, and the app accepts the match once several measurements agree with each other.
  • HD2 and up have no analog twin and play live.
  • You can also choose Digital only or Analog only. Analog only switches the HD decoder off, which saves battery.
  • Auto saves battery on stations without HD too. Searching for an HD signal that isn't there is the decoder's most expensive job, so after 30 seconds without HD it rests and only looks again for 3 seconds in every 30. If the station's HD turns up later, the next look finds it.

How the blend works has the details.

For listening

  • A "now playing" screen with a glowing VFD-style frequency display, station name, program, title and artist, album art and station logos.
  • Favorites as a scrolling strip of logo tiles. Tap ☆ to save the current station and program, hold a tile and drag it to change the order, and long-press to rename or delete. Logos are cached, so the tiles show them before a station sends them again. Settings → Storage → Export / Import favorites saves the list (with your names) to a plain text file and loads it back - for a new phone, or to move between installs.
  • Recording (since 1.3): tap ⏺ to record what you hear as an AAC file (.aac, about 1 MB a minute), the raw IQ samples from the tuner (.cu8), or both. You pick the folder once. IQ files grow fast (about 180 MB a minute), so an IQ recording stops by itself after 60 seconds unless you choose a longer limit in Settings → Recording. A new station or stopping the radio ends a recording and saves it.
  • On a tablet the screen splits in two: the radio on the left, the signal details always open on the right.
  • Plays in the background with the screen off.
  • Android Auto (fork, 1.3.1-maps6): the app in the car's launcher, with your favorites as tiles, the album art, an HD button and voice tuning.
  • Media controls in the notification, on the lock screen, and from headsets, Bluetooth and car radios. ⏮ ⏭ jump between favorites. Pause keeps the tuner running, so playback resumes live right away. The radio stops by itself after a pause (5 minutes by default) and pauses when you unplug headphones.
  • You choose what happens when another app plays sound: mute and resume, stop, or play along.
  • Light, dark gray and true black themes. The screen can turn with the phone, or stay in portrait or landscape (handy in a car mount).

Traffic and weather maps

  • On stations that carry them (the Total Traffic Network or HERE data services), a traffic map and weather radar received over the air, no internet needed. They appear under the signal line while the signal details are closed; on a tablet, tap the "Signal details" heading to close them.
  • Each map shows the date and time the station made it, in your time zone, right on the picture. The radar plays through about 90 minutes of frames, and they're kept for a few hours across restarts. The base map is from OpenStreetMap.
  • Double-tap a map to fill the screen, with bigger buttons and the screen kept on: handy for a tablet used as a car radio. Double-tap again, or press Back, to return.

Blocking ad pictures

  • Hold a finger on the album art and tap Block, and that picture won't be shown again. Settings can clear the list.

For radio people

  • Signal details: sync and service mode, MER per sideband, BER, bit rate, the analog quieting, carrier level and frequency offset, pilot level and stereo amount, the RDS code, the measured analog/HD alignment, what the blend did, tuner gain, peak level (with an overload warning) and the time to sync and to first sound.
  • A speed test and a battery line (tap "Show debug info" at the bottom of the main screen): the speed test records ten seconds of the station you hear and runs the FM demodulator and the HD decoder over it flat out, then tells you what each costs on your phone, in milliseconds of processor time per second of radio. The battery line shows the current the phone draws, also with the screen off.
  • A 5-bar signal meter for analog FM that is based on quieting (how far the noise sits below full modulation), not on the carrier level. The carrier level of an RTL-SDR depends on the gain the strongest station in the band sets, so it says little about the station you are tuned to.
  • Tuner gain, automatic or manual, applied live. Automatic measures the signal when you tune, then a watchdog keeps adjusting while you listen. It steps down at once on overload and steps up when the signal is weak. The gain that worked is remembered for each station.
  • FM stereo: Auto (mono when noisy), Always mono (cuts the hiss of weak DX stations) or Always stereo.
  • A built-in station list from FCC data (the US, plus the Canadian and Mexican stations the FCC keeps on file). The details show the city of license, power and class, and stations whose RDS code can't be turned into call letters on its own (iHeart's "1xxx" codes) still get their call sign. Nothing is looked up online.
  • A notice when the HD signal on a frequency belongs to another station than the analog one you hear (it happens to DXers), with a tap to listen to the other one.

The dongle somewhere else: rtl_tcp (1.2)

Settings → Source → rtl_tcp server on the network: the dongle sits on a PC or a Raspberry Pi running rtl_tcp (for a V4 it must be the build from the RTL-SDR Blog drivers), with the antenna wherever reception is best, and the phone gets the samples over Wi-Fi. No OTG cable, and the phone can charge while the radio plays. Everything else works as with a dongle on the phone. It needs a steady 24 Mbit/s (1.49 million sample pairs a second), so use 5 GHz Wi-Fi or a server on a cable; a slower link makes the sound stutter. On the server: rtl_tcp -a 0.0.0.0 (it listens on port 1234). rtl_tcp has no password and sends to anyone who connects, so keep it on your home network.

A dongle plugged into the phone always comes first (since 1.3): with one plugged in, the radio plays from it even when the source is rtl_tcp, and plugging one in while rtl_tcp plays switches to it at once. The setting stays as it is - unplug the dongle, and the next start is rtl_tcp again.

Android 17 and later ask before an app may connect to anything on your home network. The first time you start the radio with the rtl_tcp source, the app explains why and Android asks to allow Nearby devices (local network access); without it the server can't be reached. If you said no, allow it later in Android's settings: Apps > HiDef Radio > Permissions > Nearby devices (since 1.2.1).

If the app says "can't connect … (no answer)":

  • the phone and the server must be on the same network (a guest Wi-Fi keeps devices apart);
  • on Windows, the Wi-Fi must be a Private network (Get-NetConnectionProfile; change it with Set-NetConnectionProfile -InterfaceAlias "Wi-Fi" -NetworkCategory Private in an administrator PowerShell), and the firewall must let port 1234 in (New-NetFirewallRule -DisplayName "rtl_tcp port 1234" -Direction Inbound -Protocol TCP -LocalPort 1234 -Action Allow -Profile Private);
  • a VPN on the phone sends the connection away from your home network: turn it off, or switch on its "allow LAN access" option. The app adds a line to the message when it sees a VPN.

Over rtl_tcp the phone no longer powers the dongle: about 194 mA with the screen off (a first, short measurement), against about 530 mA with the dongle on the phone.

Private by design

Nothing is collected: no ads, no account, no tracking. Recordings (1.3) go only into the folder you pick, and the app can reach no other files. Since 1.2 the app has the internet permission (and on Android 17 and later asks for local network access, "Nearby devices"), for one thing only: connecting to the rtl_tcp server you type in. With the USB dongle it opens no network connection at all. See the privacy policy.

What you need

  • An Android device with USB host (OTG) support, Android 8.0 or newer. 64-bit ARM (arm64-v8a) is best; a 32-bit build (armeabi-v7a) is for older devices such as 32-bit car head units and old tablets.
  • An RTL-SDR dongle. Developed with the RTL-SDR Blog V4 (R828D tuner). The RTL-SDR Blog V3 and other R820T / R828D dongles use the same driver and should work on FM; a tester's 2014 Nooelec R820T does. A dongle without a temperature-compensated crystal (TCXO) is fine: the app corrects its clock error (see How the blend works).
  • A USB-OTG adapter or cable, and an antenna.
  • For HD Radio: a station that broadcasts it. HD Radio is on the air in the United States, Canada and Mexico. Elsewhere the app is an analog FM radio with RDS.
  • For AM: a dongle that can tune below 24 MHz. That is the RTL-SDR Blog V4, which has an upconverter built in, or a dongle with a direct-sampling input such as the V3 (expected to work, not confirmed yet).

The dongle is powered by the phone, and on a phone with one USB port you can't charge while it is plugged in. Measured on a Moto G Stylus 2024 with a V4, screen off: about 530 mA, roughly 12 % of the battery per hour. The dongle itself draws about two thirds of that.

Get the app

There are two ways. Please pick one and stay with it: the Play version is signed with Google's key and the APK with the developer's own key, so Android treats them as two different apps. To move from one to the other you have to uninstall first; take your favorites along with Settings → Storage → Export favorites, and Import them after (from 1.1).

Join the test on Google Play

This is the way that helps most. Google asks new developers to run a closed test with at least 12 testers for 14 days before an app can be published, and only installs from Play count.

  1. Join the testers' group: https://groups.google.com/g/hidef-radio-testers
  2. Become a tester: https://play.google.com/apps/testing/io.github.derek20la.hidefradio
  3. Install HiDef Radio from the Play Store link on that page.

Or download the APK

Get the newest HiDefRadio-...apk from the Releases page and open it on the phone. Android asks you once to allow installs from your browser or file manager. The APK is built from this source with nothing added.

To check a download: the signing certificate's SHA-256 is 0f7ba7ed4584a04293a2a76fd8b2cfd4ff83416f1c66f0647d30c329d5032117.

Feedback

Please tell me which phone and dongle you use and what works or doesn't: open an issue here, or write to hidefradioapp@yahoo.com. The speed test's three numbers and your phone's model help too: they show how much room slower phones have.

Building

  1. Install Android Studio with these SDK components:
    • NDK 30.0.16248370
    • CMake 3.22.1
    • Android SDK platform 37
  2. Clone this repository and open the folder in Android Studio.
  3. Build → Assemble Project, then run it on your phone. Wireless debugging works well, since the phone's USB port is taken by the dongle.

All native libraries are built from source by Android Studio's CMake. Their sources are in app/src/main/cpp/external, so nothing needs to be downloaded or installed separately.

Good to know:

  • The debug build installs as a separate app, HiDef Radio dev (io.github.derek20la.hidefradio.debug), so it can sit next to a release install.
  • A release build is signed only if you put a keystore.properties file with your own key in the project's root folder. The four lines it needs are described at the top of app/build.gradle.kts. That file and the key are git-ignored. Without it everything still builds, and the release build is just not signed.
  • The native code is built for 64-bit and 32-bit ARM (abiFilters in app/build.gradle.kts), as plain arm64-v8a and armeabi-v7a baselines: no -march, nothing beyond what every such device has. The signal processing uses NEON (four floats per instruction, part of every arm64 phone): the FM demodulator through its own vec4.hpp, nrsc5 through its HAVE_NEON paths, and FFTW through its NEON codelets, which CMakeLists.txt adds by hand because FFTW's own CMake build doesn't know them. Everything also builds and runs without NEON (the PC harness) with the same arithmetic order, so results can be compared across machines.

How it works

RTL-SDR dongle --USB--> libusb + librtlsdr (opened with Android's USB permission)
                           |  iqsource_usb.hpp: the one file that talks to the driver
                           |  raw IQ samples, 1,488,375 samples/s
                           |
              +------------+-------------+
              |                          |
              v                          v
      nrsc5 (pipe mode)            fmdemod.hpp (FM) / amdemod.hpp (AM)
      HD audio, station name,      analog FM in stereo, signal meter
      song info, logos, art        rds.hpp: RDS / RBDS; C-QUAM AM stereo
              |                          |
              |                    drift.hpp
              |                    puts the analog audio on the station's clock
              |                          |
              |   aligner.hpp compares the two: time offset and loudness
              |                          |
              +------------+-------------+
                           |
                           v
                       blend.hpp   delay line, look-ahead, crossfade
                           |
                           v
          native ring buffer --JNI--> Kotlin AudioPlayer --> AudioTrack
                                      RadioService (foreground) + MainActivity

One stream of samples from the dongle feeds both decoders. That does not put the two audio streams on one clock, though: the HD audio follows the station's clock (nrsc5 tracks the timing of the digital signal), while the analog audio is paced by the dongle's crystal. drift.hpp closes that gap.

How the blend works

The short version is below. docs/how-the-blend-works.md walks through it step by step for radio hobbyists, with pictures of the time line and pointers into the code.

  1. Analog first. The FM demodulator has sound within a second of tuning. The HD decoder needs a few seconds to sync and to produce its first audio.
  2. Measure the delay. A station delays its analog audio so that a receiver's HD decoder has time to catch up (the "diversity delay"). nrsc5 decodes faster than that, so in this app the HD audio comes out about 2.5 seconds before the same sound arrives on the analog side. The figure is close to 2.485 s on most Los Angeles stations, but a few are tens of milliseconds off and one wanders from day to day, so aligner.hpp measures it on every tune by cross-correlating the two audio streams. A match is accepted when the correlation is at least 0.5, or (since 1.2.1, for stations whose analog is processed very differently) when three weaker results of at least 0.3 land in one place. (AM is different in two ways, both found on KMZT 1260 and KBRT 740: nrsc5's AM audio comes out in step with the analog, not 2.5 s early, so in Auto the analog on AM plays about 3 s behind live to give the look-ahead its room; and the two waveforms hardly correlate at all, because an AM transmitter's audio processor runs the analog through a phase rotator the HD feed never sees - so on AM the aligner compares loudness envelopes, which match at 0.7 to 0.9 and line up to a millisecond or two.)
  3. Keep the two clocks together. The HD audio comes at exactly 44,100 frames per second of the station's time. The analog audio comes at 44,100 frames per second of the dongle's time, and a dongle's crystal can be far off: 1 part per million with a TCXO (RTL-SDR Blog V3 and V4), 30 to 100 ppm without one. At 57 ppm the analog gains 2.5 frames on the HD every second, so two measurements five seconds apart never agree and the blend would never start. drift.hpp resamples the analog audio by the missing few millionths. It gets a first figure from the tuning error (one crystal sets both the tuner frequency and the sample clock, so a station that shows up 5.4 kHz low at 94.5 MHz means a clock 57 ppm fast) and then the exact one from a straight-line fit through the aligner's own measurements. The tuning error stays the referee: the fit counts only once at least four measurements lie on a tight line, and it may not move the figure more than 8 ppm away from the tuning error unless half a minute of measurements prove the tuning error wrong. (On a station whose analog and HD audio are processed differently, single measurements land 10 to 20 frames off. Without this rule one of them can send the correction 40 ppm astray, which is what a tester's video showed.) The HD audio is never touched.
  4. Match the loudness. The aligner also measures how much louder one side is, and the blend brings the analog to the HD's level. The station's own "digital audio gain" field (which nrsc5 reports but does not apply) is applied to the HD audio first.
  5. Crossfade. Once a match is confirmed and the next two seconds of HD are clean, blend.hpp crossfades over half a second. The two streams are lined up to within one audio sample, so there is no echo and no skip.
  6. Look ahead. Because the HD audio is 2.5 seconds early, a dropout or sync loss is seen before it would be heard. The blend fades to analog ahead of the gap and comes back when the HD is clean again. If the HD keeps dropping, it waits a little longer each time before going back.
  7. When the audio never lines up. Then the HD signal on that frequency may belong to another station than the analog one, which happens with distant stations. A setting decides whether to play that HD anyway or stay on the analog. One exception: if the call letters from RDS and from the HD signal are the same, it is the same station with its two sides processed very differently, and the HD is played.
  8. When two stations share the frequency. A frequency is not a station: with a distant station coming in over a local one, the HD can be one station's and the analog heard another's (KDSC's HD and the analog of XETRA-FM, "91X", on 91.1 west of Los Angeles). Falling back on "the analog" in every HD dropout would then swap between two programmes. stationid.hpp keeps the evidence apart from the conclusion: which RDS code is the HD station's own (its call letters, or the audio matching closely while that code was on the air, or the code remembered with its saved logo), and whether a different code is coming in right now. Only when the audio agrees - three alignment attempts that find no likeness although the HD audio was there - or when the station's own code was proven during the same tune, does it say "another station". From then on blend.hpp plays the HD alone, like a sub-channel: silence in a dropout, never the other station, with a line on the screen that offers the other one. A call sign that only the US call-letter formula produces is never shown as a station's name (XHITZ-FM Tijuana sends the code 692B, which spells "WHTZ", a station in New Jersey).

FM stereo has a blend of its own: full stereo above 36 dB of quieting, mono below 24 dB and a gradual change in between, modelled on what car-radio tuner chips do. One finding from this project: on the RTL-SDR the noise after the FM discriminator measured almost flat from 16 to 100 kHz, where textbooks show it rising with frequency. Stereo therefore costs only about 5 dB of extra hiss, where the classic figure is around 20 dB.

Where things are

  • app/src/main/cpp/native-lib.cpp is the C++ side. It opens the sample source, streams samples into nrsc5 and the FM demodulator, handles nrsc5's events and keeps the audio ring buffers.

  • iqsource.hpp says what the radio needs from a sample source (tune, set the gain, deliver samples); iqsource_usb.hpp is the RTL-SDR dongle on the USB port, and the only file that calls librtlsdr. iqsource_tcp.hpp (1.2) is the other source: a dongle on another computer, over the network (rtl_tcp).

  • iqrecord.hpp (1.3) records the samples into a file, untouched, on a writer thread of its own (the IQ half of ⏺).

  • Next to it are nine self-contained C++17 headers with no Android code in them:

    • fmdemod.hpp: the analog FM demodulator (stereo decoder, pilot PLL, quieting meter). vec4.hpp next to it is its four-floats-at-a-time layer: NEON on ARM, plain C++ anywhere else.
    • amdemod.hpp: the analog AM demodulator - carrier PLL, synchronous detector, carrier-to-noise meter, C-QUAM stereo. It reuses the FM file's filters.
    • rds.hpp: the RDS / RBDS decoder. It needs nothing but the FM multiplex signal.
    • drift.hpp: the clock correction. A small resampler, and the tracker that works out the dongle's clock error.
    • aligner.hpp: measures the analog-vs-HD time offset and loudness difference.
    • blend.hpp: the delay line, the look-ahead and the crossfade.
    • hdsearch.hpp: rests the HD search on a station without HD.
    • stationid.hpp: whose station is this? Call letters, RDS codes and the audio as evidence for "the same station" or "two stations on one frequency".

    Feel free to lift them for your own nrsc5 project.

  • app/src/main/java/io/github/derek20la/hidefradio/ is the Kotlin side:

    • RadioEngine: the JNI functions.
    • RadioService: the foreground service, tuning, audio focus and the media notification.
    • MainActivity: the screen.
    • Recorder and AacWriter (1.3): the ⏺ recording - the folder, the files, the AAC encoder.
    • AudioPlayer, GainKeeper (the gain watchdog), Stations (the station list), Presets (the favorites), LogoCache, Settings and the rest.
  • app/src/main/assets/stations/ holds the station list. tools/fcc/make_stations.py builds it from the FCC's data.

  • app/src/main/cpp/CMakeLists.txt builds libusb, librtlsdr, FFTW, FAAD2 and nrsc5 as static libraries.

  • tools/harness runs the whole native engine on a PC against an IQ recording (.cu8), with no phone and no dongle. Every DSP step was tested that way. It also has mkdrift, which turns a recording into what a dongle with a cheap crystal would have recorded, and drifttest, which runs the clock correction through hours of made-up radio in seconds.

  • tools/lrcheck is the test that proves the FM stereo decoder has left and right the right way round.

  • docs/ has longer explanations: How the blend works.

  • store/ holds the pictures for the Google Play listing.

Known limits

  • After every tune you hear about ten seconds of analog before the HD takes over. Measuring the alignment takes that long.
  • In Auto, HD1 plays about 2.5 seconds behind Digital only. That delay is what makes the look-ahead possible.
  • Analog AM (1.1) has so far been proven on recordings of two stations (KMZT 1260, KBRT 740) in the desktop harness, not yet on the phone; the audio bandwidth is 5 kHz by default (Settings > AM audio bandwidth: 3, 5, 8 or 10 kHz). In Auto the sound on AM starts about 3 s after tuning, since the analog plays that far behind live there. The AM signal meter's bars (carrier-to-noise) still have first-guess thresholds. C-QUAM stereo is proven on a made-up signal only - no C-QUAM station is within reach of Los Angeles - so which channel is the left one has not been confirmed on the air. The clock correction does not run on AM (the envelope alignment is not fine enough to measure a crystal); with a non-TCXO dongle the blend re-aligns about every 40 s there.
  • AM HD has had little on-air testing: one station (KMZT 1260 kHz in Los Angeles) heard on the phone with an RTL-SDR Blog V4, plus off-air recordings run through the app's engine (tools/harness). AM with a V3 has not been tried yet.
  • Most testing so far has been in the Los Angeles area. Testers have run it in other places and on other phones and dongles too, and more reports are what the closed test is for.

Plans

  • 1.1 (done): analog AM with the blend and C-QUAM AM stereo, NRSC AM de-emphasis, a stereo dot on the frequency display, export / import of favorites.
  • 1.2 (done): an rtl_tcp network source - the dongle on a PC or Raspberry Pi, the phone on Wi-Fi; our nrsc5 fork (a faster HD search, the right left / right in HD audio, MER named by its true sideband); a screen rotation setting.
  • 1.2.1 (done): the blend on stations whose analog is processed very differently from their HD (it aligns sooner, stays aligned, and comes back to the HD after a dropout); rtl_tcp on AM: the Gain row says so when the server's dongle ignores the gain (a V3 in direct sampling); rtl_tcp on Android 17: asks for the new local network permission ("Nearby devices"), without which the server can't be reached.
  • 1.3: recording - audio (AAC) and IQ (.cu8, with a time limit), to a folder you choose; a dongle plugged into the phone wins over rtl_tcp.
  • Later: a DX log, seek and scan, a time-shift pause.

Credits and licenses

HiDef Radio stands on the shoulders of these projects:

Component What it does License
nrsc5 v3.2.0 + HiDef Radio patches (derek20la/nrsc5 @ 16e6142) HD Radio decoder GPL-3.0-or-later
librtlsdr, RTL-SDR Blog fork Dongle driver (V4 support) GPL-2.0-or-later
libusb 1.0.30 USB access LGPL-2.1-or-later
FFTW 3.3.10 Fast Fourier transforms GPL-2.0-or-later
FAAD2 2.11.2 + nrsc5's HDC patch AAC audio decoder GPL-2.0-or-later
DSEG font (DSEG7 Classic) VFD frequency display SIL OFL 1.1
Material icons (settings, play, pause, skip, stop) ⚙ and media buttons Apache-2.0
AndroidX, Material Components, Kotlin Android libraries Apache-2.0
  • Code from FAAD2 is copyright (c) Nero AG, www.nero.com.
  • Changes to bundled code:
    • librtlsdr: added rtlsdr_open_fd(), so the dongle can be opened with the file descriptor Android gives the app. These changes are marked "HiDef Radio patch".
    • FAAD2: nrsc5's faad2-hdc-support.patch is applied.
    • nrsc5: our fork derek20la/nrsc5, branch hidef = v3.2.0 + one commit per fix, vendored at commit 16e6142. Three fixes so far: (1) a faster HD search (src/sync.c: the frequency-offset search uses a sine table and a polynomial arc tangent instead of about 1.7 million C-library calls a second; same sync decisions, about 40 % less processor time while searching); (2) HD audio with the standard left / right and polarity (src/output.c: stock nrsc5 v3.2.0 hands out its HD audio with left and right swapped and the polarity inverted, compared with the same station's analog audio decoded per the FM stereo standard - measured on 20 Los Angeles stations, see tools/lrcheck/README.md; the fork corrects it once, for every program, so the desktop nrsc5 built from it gets it right too); (3) the HD signal quality (MER) named by its true sideband (src/sync.c: in FM, stock nrsc5 mirrors the spectrum before decoding and called the sideband above the carrier "lower"; the fork reports lower = below the carrier, upper = above). The changes are marked "HiDef Radio patch" in the source.
  • Station list (app/src/main/assets/stations/): made from the FCC's FM Query and AM Query (US government data, public domain) by tools/fcc/make_stations.py. To refresh it, follow the steps at the top of that script.
  • Thanks to redsea (MIT), used to cross-check the RDS call-letter and character tables. No code was taken.
  • Thanks to ngsoftfm (GPL, the SoftFM family) and Gqrx, the reference FM stereo decoders in the left/right check. Test tools only - nothing of them is in the app.
  • Ideas borrowed (with thanks) from nrsc5-dui and the SDRSharp NRSC5 plugin, both GPL-3.0:
    • the logo cache
    • telling logos from album art
    • signal details
    • the sync-loss grace period
    • fades on program switch

Each library's own license file is in its folder under app/src/main/cpp/external. Inside the app, Settings → About → Open-source licenses shows the credits and the full license texts.

Trademarks

"HD Radio" is a trademark of iBiquity Digital Corporation, an Xperi company. HiDef Radio is an independent hobby project. It is not affiliated with or endorsed by Xperi or iBiquity.

The station logos and album art in the screenshots were received over the air and belong to their owners.

License

Copyright (C) 2026 Derek (github.com/derek20la)

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the LICENSE file for details.

About

Android radio for RTL-SDR dongles: HD Radio (NRSC-5) and analog FM with a car-radio style blend. No internet needed.

Topics

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages