home/ atoms/ sonicpi-concurrent-threads

Pressing Run in Sonic Pi adds a new concurrent thread without stopping existing threads

In Sonic Pi, pressing the Run button while code is already playing does not restart playback — it launches the new code as an additional concurrent thread. This means a performer can layer new loops, samples, or effects over what is already running by pressing Run again. Each press creates a new thread that executes in parallel with all existing threads. This is the fundamental live-coding mechanic in Sonic Pi: not replace-and-restart, but add-and-blend. The system is described as ‘a very strongly threaded system’. This contrasts with most REPLs that re-evaluate sequentially.

Examples

Run play 60 — hear a beep. While it’s running, change to play 64 and press Run — both notes now play simultaneously as two threads.

Assessment

You have a Sonic Pi session with a bass loop running. You press Run with a hi-hat pattern. What happens? What is the difference between this behavior and pressing Run in a standard Python REPL?

“I'm all I'm doing is pressing run and I'm creating a new thread which is executing the same time as the other thread so this is a a very strongly threaded system”
corpus · sam-aaron-programming-as-performance-live-coding-with-sonic · chunk 2