Beating Threads - live coding with real time
summary
Sonic Pi implements a virtual time model and a custom sleep that keeps per-thread logical clocks in sync with real time, uses named threads plus live_loop to let code be redefined without spawning duplicates, and exposes cue/sync messaging so multiple loops align deterministically. Effects are handled by a with_fx block that scopes and tidies synths. It runs on Raspberry Pi with schedule‑ahead buffers (hundreds of ms) and demonstrably works for classrooms and live performances.
AI-written summary · about
chapters (13)
- 0:00Introduction
- 1:50Playing Sleep
- 3:15Play 80
- 5:00Play 70
- 6:30Timing Model
- 11:15Timing Example
- 14:30Rebooting
- 20:15The log
- 26:30Logical clock
- 27:10Thread local variables
- 33:08Error sample
- 37:04Queue
- 38:35Final Demo








