home/ atoms/ sonicpi-live-loop-name-uniqueness

Two Sonic Pi live_loops with the same name are not independent — the second replaces the first

In Sonic Pi, live_loop names are global identifiers. If two live_loop definitions use the same symbol name (e.g., both :beat), the second definition replaces the first at the next cycle boundary — the two do not run concurrently. Each voice must be given a unique symbol to run independently. Also: a plain loop do…end block is not live-updatable at all; it blocks its thread and cannot be redefined. Only live_loop provides both live-redefinability and a running identity. The corollary: each live_loop auto-cues its own name, so sync :drums works only if a live_loop named :drums is actually running.

Examples

live_loop :beat do; sample :bd_haus; sleep 1; end\nlive_loop :beat do; sample :sn_dub; sleep 1; end — only one loop runs.

Assessment

Given two live_loops both named :melody, predict what happens when both are evaluated, then rename them to make them independent concurrent voices.

“**Two `live_loop`s with the same name = one loop.** The second definition *replaces* the first.”
context/ · L1-instruments/sonicpi/gotchas.md · chunk 1