Fun With Functions

Hi
During lunch today I watched a video of Alex McLean demo Tidal Cycles, and a simple little riff caught my ear. So, as is my habit, I’m attempting a ham-fisted version in Sonic Pi. This is super simple and illustrates the most basic usage of function definitions in Sonic Pi for rhythmic and melodic pattern shifting. If permissible, I’d like to update this thread periodically, as the code (hopefully) improves and grows more sophisticated and extensible.

use_synth :piano

define :cars do |nn,dd|
  play_pattern_timed [nn,nn,nn+7],[dd,dd,dd*2]
end

t=0 #change me +/-

live_loop :alex1 do
  cars 60+t, 0.5
end

live_loop :alex2, delay: 8.25 do
  cars 65+t, 0.5
end

PD-Pi

4 Likes