home/ atoms/ sonicpi-use-bpm-thread-local

Sonic Pi's use_bpm is thread-local; setting it in one live_loop does not change the tempo in another

use_bpm in Sonic Pi modifies the tempo for the current thread only, not globally. If you call use_bpm 120 inside a live_loop, that loop’s sleep durations change but other live_loops continue at their existing tempo. To set a global tempo, call use_bpm before launching any live_loops (at the top level). with_bpm and density provide scoped tempo changes within a block. The corollary: use_sample_bpm :loop_amen sets sleep durations to align with a sample’s tempo — handy but changes what sleep 1 means inside that scope only.

Examples

use_bpm 120 # global — set before any live_loop\nlive_loop :kick do\n sample :bd_haus; sleep 1\nend

Assessment

Explain what happens when use_bpm 60 is called inside one live_loop while another runs at the default 60 BPM. Then show how to change tempo for the whole performance simultaneously.

“is thread-local.** Setting it in one `live_loop` does not affect another”
context/ · L1-instruments/sonicpi/gotchas.md · chunk 1