Mobile & Cloud

Tunnl

Gapless Infinite-Loop Audio on iOS, With No Streaming Server

An iOS app that plays curated ambient tracks on a gapless infinite loop, with a Node and PostgreSQL backend serving complete audio files over HTTPS instead of streaming them.

Industry
Consumer Audio
The problem

Gapless looping playback is hard to deliver over a network, since any buffering interruption at the loop point is audible. A streaming server solves it at a cost out of proportion to a small ambient catalogue.

  • Buffering at the loop point is audible and breaks the experience
  • A streaming server is disproportionate infrastructure for the catalogue size
  • Audio and artwork need hosting separate from the API
  • The app has to be demonstrable without a live backend
  • Deployment onto a single VM needed to be repeatable by someone else
What we built

An app that caches each track on first play and loops from the local copy, backed by a REST API and blob storage serving complete files over HTTPS with no streaming layer.

  • Fetch the catalogue at launch and on each foreground return
  • Download each audio file on first play and cache it on device
  • Loop from the local copy so the network is never in the loop path
  • Serve complete files over plain HTTPS from blob storage
  • Fall back to bundled demo tracks when no API URL is configured
  • Write a step-by-step VM deployment runbook before the cutover

How it was built

The loop point cannot touch the network

A genuinely gapless loop is difficult over a network, because any buffering hiccup at the loop point is audible. Running a streaming server to avoid it is expensive infrastructure for a catalogue of ambient tracks.

Cache first, then loop locally

The app fetches the catalogue at launch and on each return to foreground, downloads each audio file on first play, caches it on device, and loops from the local copy. The network is involved once per track and never at the loop point.

That decision removed the streaming server entirely. The backend serves complete files over plain HTTPS, so there is no adaptive bitrate, no session state and nothing to operate.

Demoable with no backend at all

With no API URL configured the app runs fully offline on bundled demo tracks, which makes it demonstrable anywhere without infrastructure. The deployment runbook was written before the cutover rather than after it.

Before
  • Gapless looping unreliable over the network
  • A streaming server would have been required
  • No way to demo the app without infrastructure
After
  • Looping happens entirely from the on-device cache
  • No streaming server to run or operate
  • App demoable offline on bundled tracks
  • Deployment documented as a repeatable runbook
Stack
iOS
SwiftSwiftUIOn-device caching
Backend
Node.jsTypeScriptREST API
Data & Storage
PostgreSQLAzure Blob Storage
Infrastructure
Azure VMDockerCaddy TLS