Sonic Pi is a strongly-timed language where sleep controls when events occur rather than pausing execution
Sonic Pi is built around a precise timing model: sleep does not merely pause the program — it specifies the exact musical time at which the next event should occur. Aaron describes it as a language where he ‘has times’ not types. This is backed by formal academic proofs of the timing system’s accuracy. The consequence is that two consecutive play commands without any sleep between them execute at time zero — they sound simultaneously — rather than one after the other. This is counter-intuitive coming from procedural languages where sequential lines always execute in sequence.
Examples
play 70
play 75
# both notes sound at time 0 — a chord, not a melody
play 70
sleep 1
play 75
# melody: 70 at beat 0, 75 at beat 1
Assessment
Predict the musical result of three play calls with no sleep between them. How does this differ from most programming languages’ sequential execution model?