all notes

engineering8 min readby Andrew Stockus

Building Sonos Cloud: Multi-Zone Venue Audio Control from a Browser

How we built a cloud-based audio control system for multi-zone venues: per-zone volume and source management, a one-tap show mode that syncs every speaker, and a nightly auto-reset.

  • iot
  • react
  • fastapi
  • audio
  • hardware

When you're running a large outdoor venue with multiple zones — dining area, bar, stage, walkways, restrooms — audio management becomes surprisingly complex. In most venues the "system" for controlling a fleet of Sonos speakers is whoever happens to be near one opening the Sonos app on their phone. The result is a cacophony: different music in adjacent zones, volume wars between staff members, and speakers left blasting at full volume after closing time. Operators need centralized control with per-zone management, and they need it accessible from anywhere — not just from someone standing next to a speaker.

Zone Architecture

Sonos Cloud groups a venue's speakers into logical zones — for example a main dining area, a bar, a stage area, the walkways, and a restroom corridor. Each zone has independent volume control, source selection, and scheduling rules. The main dining area might play mellow jazz at 40% volume, while the bar zone runs upbeat music at 60%, and the stage zone is silent until a live performance starts.

The Sonos API (specifically the Sonos Control API for cloud-based access) lets us group speakers, set volume levels, control playback, and query status. We built a FastAPI backend that acts as the intermediary between our React dashboard and the Sonos cloud. The backend maintains a model of the venue's audio state and exposes a REST API that the frontend consumes.

The React Dashboard

The control dashboard was designed for speed and simplicity. The main view shows every zone as a card, each displaying the current source (playlist name), volume level as a slider, play/pause/skip controls, and a mute button. Staff can adjust any zone with a single tap or slide. The interface is mobile-responsive because the venue manager's primary device is their phone, and they're rarely sitting at a desk.

We added preset buttons for common configurations: "Lunch Service" sets all zones to low-volume jazz, "Happy Hour" bumps the bar and dining zones with livelier playlists, "Event Mode" silences all zones except stage, and "Closing" fades everything down over 5 minutes. These presets are configurable by the venue manager through a settings panel — no code changes needed to create or modify presets.

Show Mode: Synchronized Audio

Venues that run live shows need every speaker playing the same audio track in perfect sync at a specific volume level. Done by hand in the Sonos app, that means grouping all the speakers, selecting the track, and setting the volume unit by unit — a multi-minute process that fails in familiar ways (speakers dropping out of the group, wrong volume on individual units).

We built a dedicated "Show Mode" button. One tap and the system takes a snapshot of the current audio state (so it can restore it later), groups every speaker into a single zone, loads the show playlist, sets each speaker to its calibrated volume level (each speaker has a different optimal volume based on its location and acoustics — a walkway speaker runs louder because it's competing with ambient noise), and starts playback. When the show ends, one tap on "End Show" restores the previous state. A multi-minute manual process becomes a one-tap automated one.

The Midnight Auto-Reset

One of the most-appreciated features was the simplest. Every night at midnight, a scheduled job resets all speakers to a default state: volume at 0%, playback stopped. This solved the recurring problem of speakers being left on overnight — either playing music to an empty venue or, worse, resuming at full blast when they reconnected to power the next morning. The auto-reset also serves as a safety net: no matter what state the system is in, midnight is a clean slate.

We implemented this as a cron job in the FastAPI backend that calls the Sonos API to set each speaker to volume 0 and stop playback. The job logs its execution and sends a confirmation to the venue manager's phone if any speaker was found still active at midnight, which doubles as a running report on how often staff are leaving speakers on after close.

Deployment Challenges

Working with physical hardware in a real venue introduced challenges you don't face in pure software projects. WiFi reliability was the biggest issue — Sonos speakers need a stable network connection, and a venue with hundreds of visitors on their phones creates WiFi congestion. We set up a dedicated SSID on the 5GHz band for the Sonos system, separate from the guest WiFi, which sharply reduces speaker dropout events.

The Sonos API also has rate limits that we had to respect. Rapid-fire volume changes (a user dragging a slider quickly) could exceed the limit and cause temporary lockouts. We implemented client-side debouncing on the volume sliders, sending updates at most once every 300ms, and server-side queuing that batches rapid changes. The user experience feels instantaneous, but the actual API calls are throttled to stay within limits.

Impact

The system turns audio from a source of staff friction into a managed amenity. Zone-based control means the right music plays at the right volume in every area. Presets remove the daily setup routine. Show Mode turns a stressful scramble into a one-tap operation. And the midnight reset ensures the venue always starts the next day clean.

Digitize operations like this.

BigDevelop scopes, builds, and runs systems like this one, from a single integration to a company-wide program.