- Swift 48.2%
- Python 42.7%
- HTML 9.1%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
|
|
||
| assets | ||
| docs | ||
| ios | ||
| tests | ||
| .gitignore | ||
| index.html | ||
| instant.py | ||
| README.md | ||
| server.py | ||
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
JUNKpadding doesn't fool the buffer: the speaker re-requests past it with aRangeheader. - AAC (ADTS) streams are rejected by audioClip.
- audioClip pauses or ducks whatever is playing and resumes it by itself, with no snapshot/restore.