LatencySoup: How to stir up synchronous beats?

I’m looking to prototype an application for streaming audio at a silent disco. The setup involves one audio producer streaming to approximately 100 consumers who are together in an outdoor space, each listening on their headphones and everyone is connected to the same AP.

Objectives:

  • Keep all the consumers on the same beat (+/-50ms)
  • Keep the dj one beat “ahead”
  • Measure the individual latency of each consumer

I’m estimating the typical latency to be ~225ms end to end. For a typical song that’s 120bm, each beat is 500ms, so a dj would appear to move out of beat. To mitigate that, we can introduce ~200ms of additional latency and have everyone hitting a beat.

Some questions:

  • Has a similar system been implemented or researched before?
  • Are there any easy-to-use demos w/ this single audio broadcaster setup?
  • How can I estimate realtime latency “reports” from each consumer?
  • Can I introduce latency to each consumer so they’re all listening in sync?
  • What would be the easiest setup I can scrape (E.g, a demo akin to StreamApp/src/main/webapp/samples/publish_audio.html at master · ant-media/StreamApp · GitHub )
  • Any hacks that exploit the locality (e.g: multicast udp

Estimate for latency:

- ~0ms        DJ Deck, source
- ~0.5-2 ms   A/D Conversion (Focusrite Interface)
- ~1-5 ms     Driver/Interface Latency (Focusrite)
- ~20-40 ms   Audio Codec Encoding Latency
- ~10-30 ms   WebRTC Latency
- ~2-5 ms     Network Latency
- ~10-100 ms  Safari/iPhone Processing
- ~10-50 ms   Additional Overheads (Variable)

Total: ~55-230 ms  Estimated Latency