Dev.to AI πŸ€– Ai πŸ‘ 0 πŸ“– 6 min read

TrailPulse: An Offline-First Spatial Audio Guide for Zero Screen-Time Outdoors

This is a submission for the Hacktoberfest Open-Source AI Challenge Week 1: Touch Grass What I Built Modern outdoor technology suffers from a paradox: tools intended to enrich our time in natureβ€”like plant id

TrailPulse: An Offline-First Spatial Audio Guide for Zero Screen-Time Outdoors

This is a submission for the Hacktoberfest Open-Source AI Challenge Week 1: Touch Grass

What I Built

Modern outdoor technology suffers from a paradox: tools intended to enrich our time in natureβ€”like plant identifiers, trail navigators, and peak findersβ€”demand our constant visual attention. Hikers often pause at breathtaking vistas only to look down at glass screens, read text cards, and tap through menus. To make matters worse, backcountry trails and heritage parks frequently cut through cellular dead zones where conventional cloud-tethered apps fail completely.

TrailPulse inverts this interaction model under a strict guiding philosophy: "Zero Screen-Time Outdoors."

It is an offline-first Progressive Web App (PWA) that converts standard GPX routes into location-triggered spatial audio narratives. Hikers and heritage walkers can prepare their tours ahead of time, plug in wireless earbuds, lock their phones, and put them in their pockets.

As they hike:

  • Dynamic Haversine geofencing continuously monitors satellite coordinates in the background.
  • Proximity alerts trigger when users cross within 25–40 meters of a physical landmark, sounding a gentle entrance cue before playing a sensory audio vignette directly into their earbuds.
  • Lock-screen controls via the MediaSession API display landmark names and allow single-tap earbud pause/resume functionality.
  • An immersive experience allows users to take in the physical landscape with their eyes up and completely off-screen.

Demo

Live Application: https://trailpulse.onrender.com

Quick Test for Evaluators (60s Desk Demo):

If you are reviewing this from your desk and cannot visit an outdoor trail right now, TrailPulse includes a built-in testing pipeline:

  1. Open the live demo.
  2. Under Curated 1-Click Demo Trails, select Red Fort Quick Tour or Humayun's Tomb Garden (curated 45-second UNESCO Heritage demos).
  3. Click Load & Explore to unpack the audio bundle client-side into IndexedDB.
  4. Tap the GPS Simulator button to simulate physical movement along the path and hear automated proximity triggers fire without leaving your chair.

Code

TrailPulse β€” Offline-First Nature Audio Guide

"Touch Grass, Screen Off": A zero-screen-time nature audio guide for Hacktoberfest 2026. Hikers prepare a trail tour at home, then hike with their phone locked in their pocket while spatial background GPS triggers ambient naturalist audio vignettes directly through wireless earbuds.

Hacktoberfest 2026 Live Demo License: MIT PWA Ready Open Weights: Gemma 2 Audio: ElevenLabs

The Philosophy: "Zero Screen-Time Outdoors"

Modern outdoor technology suffers from a paradox: apps intended to enhance time in nature (plant identifiers, digital maps, peak finders) pull the user’s eyes directly toward glass screens. Hikers stop at vistas, open apps, scan menus, and read paragraphs of text while ignoring the physical landscape around them. Furthermore, backcountry recreation frequently occurs in complete cellular dead zones where conventional cloud-hosted AI APIs fail entirely.

TrailPulse inverts this interaction model by treating the screen as an obstacle to be minimized.

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Pre-Trip Preparation Phase (Connected: Home / Cellular) β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                            β”‚ Uploads GPX Track
                            β–Ό
           β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
…

Repository: https://github.com/syed-yaga/TrailPulse

License: MIT

How I Built It

TrailPulse is built around a split-phase architecture that cleanly separates generative computation from field runtime.

[ Preparation Phase (Pre-Hike / Connected) ]
GPX Track ──▢ Express Orchestration Server
                 β”œβ”€β”€ Overpass API (400m POI context)
                 β”œβ”€β”€ Gemma 2 (Local / Ollama) ──▢ Tactile Nature Vignettes
                 └── ElevenLabs TTS ───────────▢ Audio Synthesis
                                                        β”‚
                                            Compressed .zip Bundle
                                                        β”‚
[ Execution Phase (Field Runtime / 100% Offline PWA) ]  β”‚
IndexedDB Cache ◀── In-Memory JSZip Unpack β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
      β”‚
navigator.geolocation (Continuous satellite polling)
      β”‚
Haversine Proximity Check (Distance <= 40m)
      β”‚
Soft Chime Alert (Web Audio API) ──▢ Narration Playback ──▢ Wireless Earbuds
      β”‚
Lock-Screen Metadata (MediaSession API)

1. Open-Source AI Core: Gemma 2 via Ollama

To generate audio narratives that feel present and observant rather than like an encyclopedic Wikipedia read, we utilized Google's open-weights Gemma 2 running locally via Ollama.

Gemma 2 was prompted to write concise, 30–45 word sensory scripts focusing strictly on physical touchpoints (such as canopy foliage, sandstone textures, bird calls, and prevailing winds) while prohibiting conversational filler. For users without a local Ollama instance or ElevenLabs API key, the orchestration layer includes a deterministic procedural naturalist fallback and Web Audio synthesizer so the full pipeline works out of the box with zero external dependencies.

2. Client-Side Bundle Decompression & IndexedDB

Backcountry connectivity is unreliable. Instead of streaming audio files on demand, TrailPulse packages the manifest and audio into a compressed .zip bundle.

Upon download, the client uses JSZip to extract the archive in-memory, saves the raw audio blobs to the browser's IndexedDB, and indexes them by waypoint ID. Once loaded, the app operates entirely decoupled from the network.

3. Surviving Mobile Screen Lock

Mobile browsers aggressively throttle JavaScript timers and suspend background execution when a user turns off their display. TrailPulse solves this using a multi-pronged approach:

  • Audio Context Priming: User interaction unlocks the audio thread before the walk begins.
  • Heartbeat Audio Loop: A continuous, low-volume audio loop keeps the browser runtime active in the background.
  • Lock-Screen Integration: The navigator.mediaSession API binds landmark names and audio states to the lock-screen controls, enabling single-tap earbud interaction.
  • Debouncing & Hysteresis: A visited-waypoint state engine prevents repetitive audio retriggers while the hiker lingers at a scenic overlook.

Why Does Open Innovation Matter?

Outdoor exploration and mobile edge computing demand resilience. Relying exclusively on proprietary cloud AI APIs creates several critical failure modes:

  • Cellular Dead Zones: Proprietary conversational APIs require active internet connectivity. In canyons, dense forests, or remote historical sites, a cloud-tethered app stops functioning.
  • Cost & Privacy: Continuous streaming or per-query API calls can turn outdoor utility tools into expensive, metered services that track user locations on remote servers.
  • Local Self-Reliance: Open-weight models like Gemma 2 allow developers to run generation completely on local machines or private edge nodes.

The TrailPulse Solution

By leveraging open-source AI locally during the trail preparation phase and open web standards (PWAs, IndexedDB, and the Geolocation API) during the walk, TrailPulse proves that modern software can enhance time in nature without tethering users to an internet connection or trapping their eyes behind a screen.

My Agent Session

  • Architectural Decoupling & Offline Runtime: Directed the agent to enforce a strict boundary between tour generation and hike playback. Rather than executing cloud queries in zero-reception backcountry zones, we engineered a split-phase pipeline where Gemma 2 narrations and TTS audio are compiled into self-contained ZIP bundles, unpacked 100% client-side via JSZip, and cached into IndexedDB for zero-network playback.
  • Outdoor GPS Tracking & Inversion Fix: Diagnosed an outdoor tracking bug where departing the trailhead caused remaining distance to climb instead of decrementing. Directed the agent to replace naive nearest-neighbor queries with a sequential unvisited waypoint queue, enforcing Haversine approach tracking (≀ 40m) that counts down toward zero before advancing the trail pointer.
  • Mobile Audio Autoplay & MediaSession Integration: Resolved strict mobile browser autoplay and background throttling policies. Instructed the agent to trigger a silent audio buffer on the physical "Start Hiking" touch gesture to unlock HTML5 audio permissions, pairing it with the MediaSession API for persistent lock-screen metadata and Bluetooth earbud controls.
  • Evaluator UX & Responsive HUD Polish: Guided responsive layout refinements to prevent mobile overflow, transforming the diagnostic telemetry into a responsive 2Γ—2 Live GPS Debug HUD and introducing 1-click 45-second UNESCO Heritage demo bundles (Red Fort & Humayun's Tomb) for instant judge testing without API keys.

By pairing human architectural direction and outdoor edge-case debugging with the agent’s rapid implementation and continuous build verification, we delivered a resilient, zero-cloud PWA built for real trails.

Prize Categories

  • Best Use of Gemma: We use Google's open-weight Gemma 2 via Ollama to generate concise, tactile, sensory nature and heritage vignettes from raw GPX coordinates and Overpass POI data, strictly avoiding conversational filler.
  • Best Use of Render: Render hosts TrailPulse's production PWA frontend and orchestration API runtime, serving the compiled static application and 1-click demo bundles at https://trailpulse.onrender.com.
  • Best Use of ElevenLabs: ElevenLabs provides the natural, studio-quality voice narration synthesized during trail preparation, giving the offline guide its immersive audio presence.
πŸ“° Read the original article on Dev.to AI

Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes β€” full credit and traffic to the original publisher.