Skip to content

About

A braille-rendered globe of internet radio stations, in your terminal (Rust + ratatui)

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

11 Commits

Folders and files

Repository files navigation

mondi-terminal

mondi-terminal — a braille globe of internet radio in your terminal

A braille-rendered orthographic globe of internet radio stations you spin between, right in your terminal — pick a spot on the planet and listen. It pulls verified, geolocated stations from radio-browser.info and renders the globe with Unicode braille.

The terminal edition of Mondi, a little radio for a whole world of stations. Join the hardware waitlist on the site or say hello on Discord.

Install

The main command is mondi; radio remains a compatibility alias. Use Rust 1.88 or newer for the locked dependencies. Station discovery requires curl on your PATH. For audio, install mpv (recommended) or ffplay; ffmpeg supplies ffprobe for stream verification.

On macOS with Homebrew: brew install rust mpv ffmpeg (curl is included with macOS).

Install from source with Rust (available now):

cargo install --git https://github.com/steferic/mondi-terminal --locked
mondi

The Rust package is named mondi-terminal; installation provides both mondi and radio. Both commands launch the same app and share the same library. No crates.io publication under the new name is assumed. If your shell cannot find mondi after installation, add Cargo's binary directory to your PATH: export PATH="${CARGO_HOME:-$HOME/.cargo}/bin:$PATH".

Prebuilt binary — after the first release (macOS / Linux):

curl --proto '=https' --tlsv1.2 -LsSf \
  https://github.com/steferic/mondi-terminal/releases/latest/download/mondi-terminal-installer.sh | sh
mondi

Windows (PowerShell):

powershell -ExecutionPolicy Bypass -c "irm https://github.com/steferic/mondi-terminal/releases/latest/download/mondi-terminal-installer.ps1 | iex"

(The prebuilt installers/URLs become live once the first version tag is released — see Releasing.)

Run from a clone

To install your local checkout on your PATH:

cargo install --path . --locked
mondi

For development without installing:

cargo run --release         # spin the globe
cargo run -- --snapshot     # render one frame as text (no TTY needed) — used for tests

--snapshot prints a single frame for a quick rendering check.

For a demo, use a terminal around 120 columns × 40 rows or larger. The 24 starter stations span 24 different countries and appear immediately, with a random one selected each launch and the globe centered on it. Press Enter to start audio. More stations arrive as verification completes. Set your system output device and volume before presenting. After typing a search (for example /FIP), press Enter once to finish editing and again to tune the highlighted result.

Controls

Action Keys
Next / previous station and immediately tune →/←, l/h, or j/k
Tune the highlighted station Enter
Like / unlike highlighted station s
Open liked stations / return to Explore v
Recent stations / return to Explore H
Return to previous tuned station Backspace
Search name, city, country or genre /, then type; Enter/Esc finishes search
Clear search, collection and station filters c
Sleep timer: off → 15 → 30 → 60 minutes → off t
Random station x
Filter by continent / country f
Globe size (zoom the earth in / out) ] / [ (also + / -)
Play / stop stream p or Space (best-effort; needs mpv or ffmpeg installed)
Radio filter (lo-fi AM-radio sound) r (default off; clean audio first)
Maximize globe (full screen → more braille detail) z
Toggle country borders b (default on)
Reload / re-verify stations L
Quit q or Esc

These are always visible in-app too: a Controls panel sits under the station list and doubles as a live status readout (it shows the current radio fx / borders states and updates as you toggle them).

Arrows and random immediately tune the highlighted station and rotate the globe. Search, filters and opening your liked list do not interrupt audio. Press Enter to tune a search result. Press s to like/unlike and v to open liked stations; the controls show your current like state and total liked count. Press c to explore again. The player status names the actual tuned station. A running external player is not proof of audible/live content; if it exits, the app shows a retry message. Space stops playback immediately. Random avoids the current selection when possible.

Your library

Browser edition

The Mondi landing page runs this same Rust/Ratatui app compiled to WebAssembly, inside xterm.js. src/app.rs contains the shared UI; src/web.rs supplies the browser host boundary. No server-side terminal, shell, or audio-player process is needed. Browser audio uses native media playback and requires HTTPS streams; r explains that ffmpeg radio effects are native-only. Browsing, favorites, search, filters, zoom, history and sleep remain the shared Rust behavior.

See ../radio-phoenix/research/wasm-terminal-work.md for build instructions. The browser imports your existing Mondi local library automatically. Exported JSON also works with the native MONDI_LIBRARY setting below.

Storage and backup

Likes and the last 100 distinct tuned stations are saved in $XDG_DATA_HOME/mondi-terminal/library.json, or $HOME/.local/share/mondi-terminal/library.json when XDG_DATA_HOME is unset. Set MONDI_LIBRARY to use a different file. Full station records are retained, so refreshes or missing directory entries do not erase your discoveries.

Writes use a temporary file and rename; the previous library is retained as library.json.bak. Copy the JSON file to back it up or move it to another machine. Invalid files are left untouched, and storage errors are displayed in yellow. Do not run multiple instances writing the same library simultaneously.

The browser edition exports the same versioned library format. To open a downloaded browser library in the terminal without touching your existing one:

MONDI_LIBRARY=/absolute/path/to/mondi-library.json mondi

This is local storage, not an account or automatic cross-device sync. Browser storage can be cleared; export a backup. The sister website lives in ../radio-phoenix; product reasoning is documented in its research/radio-garden/product-brief.md.

Filtering (f)

f opens a popup with genre, country, and continent filters. Use g, c, or t to jump to a section, ↑/↓ to choose, Enter to apply, and Esc to close. Reopen f to add another filter. All three stack with / search and your current collection; filtering never interrupts playback.

Each section lists values in the loaded library with total station counts. Choose “All …” to reset one dimension or “Clear all filters” to reset all three; c outside the popup also clears search and returns to Explore. Genre groups the raw tags into 19 broad categories (only populated categories appear), merging subgenres and spelling variants. A station can appear in several categories, counted once in each. Unrecognized or missing tags fall under “Eclectic & Other”; original tags remain available through / search. Country uses the country code for a stable match; continent is derived from that code. / also searches country names, genres, and continent names. The globe, station list, and random selection use the results. Unknown country codes appear under “Other” for continent.

Saved preferences

Native Mondi saves Radio FX (r), borders (b), maximized view (z), and globe size ([ / ]) immediately when changed, and restores them on the next launch. Preferences live in $XDG_CONFIG_HOME/mondi-terminal/settings.json (default ~/.config/mondi-terminal/settings.json); override with MONDI_SETTINGS. They are separate from the station cache and saved library. Playback and sleep timers do not start automatically. Invalid files are preserved, and save errors are shown in the terminal.

Radio filter (r)

r toggles a lo-fi AM/shortwave radio sound on the audio: a narrow band-pass (≈300–3400 Hz, so no real bass or treble), broadcast-style compression, a touch of bit-crush grit, and a little makeup gain. It's applied via the spawned player's audio-filter option (mpv --af / ffplay -af, an ffmpeg/libavfilter chain — see RADIO_AF in src/app.rs), so it needs mpv or ffplay installed. Toggling it while a stream is playing re-spawns the stream with/without the filter. (cvlc plays clean — no simple CLI filter path.)

The globe renders purely in braille — fast text cells. There's no image/graphics- protocol mode; for finer detail see below.

Why braille + 50m data (precision)

A terminal isn't limited to 1-bit pixels. Unicode braille (⠿) packs a 2×4 grid of dots per character cell — finer than half-blocks (1×2) or sextants (2×3) — so the globe is drawn at the maximum spatial resolution a terminal glyph allows. ratatui's Canvas widget rasterizes lines/points to braille for us; the coastline polylines and station markers project into canvas space via a small orthographic-projection core.

The other half of precision is the source data: this uses Natural Earth 50m coastlines and country borders (≈60k + 20k points) — roughly 4× the detail of the 110m set, which is about the resolution a braille globe can actually resolve (10m would be invisible at terminal size and bloat the binary).

Making braille finer

A braille dot is exactly 1/8th of a character cell, so dot size = your terminal font size, and the globe's resolution = (cells across) × (2 or 4 dots). Two ways to get 2–4× more detail while keeping the fast text rendering:

  • Shrink the terminal font (Ghostty: ⌘ −) — smaller dots and more cells.
  • Maximize the globe with z — hands the whole terminal to the globe so braille gets the most cells. Combine both for a very crisp globe.

Country borders (Natural Earth 50m admin-0 land boundaries) draw as a b-toggleable layer, rendered in color: coast cyan / borders tan / land green.

Dirty-flag redraw: the screen only repaints when something changes, so the 50m detail costs ~zero CPU at idle.

Only-working stations (verified)

New discoveries are stream-probed before being added; saved favorites, recent stations and curated seeds remain available even when currently unreachable. Verified stations are cached long-term in $XDG_CACHE_HOME/mondi-terminal/stations.json (default ~/.cache/mondi-terminal/stations.json). Set MONDI_STATION_CACHE to override. The station cache is separate from your likes/history library.

On launch, the cached list appears immediately. A background health check retries failed streams once, removes unavailable streams from Explore, and seeks verified replacements, preferring their country and then their continent. Likes, history, and current playback are preserved. If every check fails (for example, offline), the existing cache is kept. Cache write errors appear in the terminal.

A healthy completed cache skips directory search entirely. First discovery, interrupted discovery, and replacement searches fetch up to 10,000 geolocated Radio Browser candidates. Countries take turns within each continent, with a budget of up to 600 probes and a target of 200 verified stations per continent; regions with fewer working candidates retain everything that passes. This avoids letting globally popular stations consume the entire discovery budget. Streams appear and are checkpointed as they pass. L repeats the check/replacement cycle.

Stream checks use ffprobe with a 12-second wall-clock limit per attempt; if it is unavailable, the app falls back to an HTTP/content-type check. Cached stations still need internet access for listening, and a successful check cannot guarantee future stream availability. Directory coverage and accurate map coordinates vary by region.

Architecture

mondi-terminal/
├── Cargo.toml
└── src/
    ├── globe.rs       # projection core — no ratatui/IO deps (pure math)
    ├── coastline.rs   # baked Natural Earth 50m coastlines (generated data)
    ├── borders.rs     # baked Natural Earth 50m country borders (generated data)
    ├── stations.rs    # curated fallback station table
    ├── app.rs         # shared ratatui app, controls, native audio and discovery
    ├── library.rs     # persistent likes and recent stations
    ├── web.rs         # WebAssembly host boundary
    ├── ansi.rs        # shared cell-buffer to ANSI encoding
    ├── main.rs        # mondi entry point (default cargo run target)
    └── bin/radio.rs   # backwards-compatible radio entry point

globe.rs is deliberately dependency-free (just projection math). The shared UI lives in app.rs, alongside conditionally compiled native services. The coastline.rs / borders.rs data modules are pre-generated and committed, so the crate builds with no external assets.

Regenerating the geo data

coastline.rs and borders.rs are baked from Natural Earth 50m vector data (ne_50m_coastline and ne_50m_admin_0_boundary_lines_land, as GeoJSON). They rarely need regenerating; if you do, fetch the GeoJSON and emit each line as a &[(f32, f32)] of (lon, lat) points into the corresponding const array.

Releasing

Prebuilt binaries + installers are produced by dist (config in dist-workspace.toml, CI in .github/workflows/release.yml). To cut a release, tag a version and push the tag:

git tag v0.1.0
git push origin v0.1.0

GitHub Actions then cross-compiles mondi and radio for macOS (arm64/x64), Linux (arm64/x64), and Windows (x64), and publishes a GitHub Release with the .tar.xz/.zip artifacts, checksums, and the curl … | sh / PowerShell installers referenced above.

Roadmap

  • Braille globe + snap-to-station navigation + station list
  • Mono + color render styles
  • Live stations from radio-browser.info, with concurrent stream verification
  • Maximize toggle + radio (lo-fi AM) audio filter
  • Shaded style; more palettes
  • Robust audio (rodio/symphonia instead of spawning mpv)
  • Search / filter, favorites

About

A braille-rendered globe of internet radio stations, in your terminal (Rust + ratatui)

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

⌂ Proxy