Hardware Reference
In-Depth Information
FIGURE 7-11 Using algorithms to change the order of notes in lists
In Sonic Pi you can use threads to run more than one script simultaneously, in much
the same way as you can do in Scratch. To run multiple tunes at the same time, encase
the first tune between in_thread do and end . For example:
in_thread do
with_synth “saw_beep”
10.times do
if rand < 0.5
play 37
else
play 49
end
sleep 2
end
end
Next, wrap a second tune between in_thread do and end , and place this code after
the first block, as in Figure 7-12. Although this section of code is beneath the first in
Search WWH ::




Custom Search