No description
  • Swift 48.2%
  • Python 42.7%
  • HTML 9.1%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-11-11 19:09:09 +00:00
assets Add Sonos intercom POC with low-latency instant mode 2026-11-10 09:40:28 +00:00
docs Add Sonos intercom POC with low-latency instant mode 2026-11-10 09:40:28 +00:00
ios iOS README: correct how to find the team ID 2026-11-11 19:09:09 +00:00
tests Add Sonos intercom POC with low-latency instant mode 2026-11-10 09:40:28 +00:00
.gitignore Add Sonos intercom POC with low-latency instant mode 2026-11-10 09:40:28 +00:00
index.html Enable instant mode without TLS and surface broadcast errors 2026-11-10 12:45:07 +00:00
instant.py Add Sonos intercom POC with low-latency instant mode 2026-11-10 09:40:28 +00:00
README.md Add native iOS app: instant mode running entirely on the iPhone 2026-11-10 12:59:20 +00:00
server.py Enable instant mode without TLS and surface broadcast errors 2026-11-10 12:45:07 +00:00

intercom

Created in T3 Code.

Docs: how it works (architecture, sequence diagrams, latency analysis).

iPhone app: ios/, a native Swift port of instant mode that runs entirely on the phone. The Python POC below stays as the reference implementation.

POC: mic → Sonos over the local network

Tests the hypothesis that an "Intercom" app can broadcast to Sonos using only the speakers' local UPnP/SOAP interface (port 1400), with snapshot/restore of whatever was playing.

python3 server.py            # needs ffmpeg on PATH; stdlib only otherwise
# open http://localhost:8000  -> Scan -> pick speaker(s) -> Start broadcast

Run it on a machine on the same LAN as the speakers, and open the page on that same machine (mic access needs localhost or HTTPS). Options: --host <ip> if auto-detected IP is wrong, --tail <s> to wait longer before restoring, --port.

Offline check without hardware: tests/mock_sonos.py <port> is a fake speaker that logs SOAP calls (use 127.0.0.1:<port> as the speaker address).

Latency findings (measured on a 2013 Play:1, S2 firmware)

Path Speaker starts playing after
UPnP x-rincon-mp3radio:// live MP3 128 kbps (old live mode) ~6.2 s
UPnP radio, live MP3 320 kbps / 32 kbps ~3.7 s / ~7.1 s
UPnP radio, whole stream available instantly ~2.1 s (fixed floor)
UPnP http:// finished file (record-then-play) ~0.1 s
Local audioClip API (wss :1443), live MP3 128 kbps ~1.15 s
Local audioClip, live WAV 44.1 kHz stereo PCM ~0.17 s
Instant mode end-to-end (open control socket + PCM) ~0.3 s (Play:1), ~0.13 s (Symfonisk)
  • The radio player waits for ~64 KB and ~2 s; the audioClip player waits for ~16–20 KB. Both are byte thresholds, so less compression = faster start. Uncompressed PCM fills it in ~0.1 s.
  • TLS handshake to the speaker's control socket costs 0.3–0.9 s, so the server opens it at scan time and keeps it open.
  • RIFF JUNK padding doesn't fool the buffer: the speaker re-requests past it with a Range header.
  • AAC (ADTS) streams are rejected by audioClip.
  • audioClip pauses or ducks whatever is playing and resumes it by itself, with no snapshot/restore.