Okay, here’s a tricky one. I have some routines that do lfos, envelopes, etc., for samples or synths. If a sound is played inside a density block, and I call a function that spawns a new thread (to apply an lfo, e.g.), will the times in the spawned thread also have the density applied to them?
Thanks!
I think they will also have it applied, as threads inherit the caller’s BPM.
I ran this as a little trial:
puts "outside", current_bpm
sleep 1
density 2 do
puts "inside", current_bpm
in_thread do
puts "thread", current_bpm
end
sleep 1
end
And it printed this, which I think confirms it:
{run: 161, time: 0.0}
└─ "outside" 60.0
{run: 161, time: 1.0277}
└─ "inside" 120.0
{run: 161, time: 1.0277}
└─ "thread" 120.0
{run: 161, time: 1.5277}
└─ "thread" 120.0
{run: 161, time: 1.5277}
└─ "inside" 120.0
Phew! Thanks! That solved what potentially could have been a gnarly problem.