Improvising in live code, with syncopation

I find it hard to jam/sketch/improv in Sonic Pi, purely because I’m not a live coding expert. To help me on my way, there MUST be a quicker way to realise the following (unoriginal) riff that came to me:

use_bpm 100

live_loop :crotchet do
sample :perc_snap
sleep 1
end

blues scale [60, 60, 51, 52, 53, 54, 55]

live_loop :blueRiff do
use_synth_defaults release: 0.5
play 60
sleep 0.5
play 60
sleep 1
play 51
sleep 1
play 52
sleep 1
play 53
sleep 1
play 54
sleep 0.5
play 55
sleep 1
end

You could create the riff using a ring, and associated note timeings using another ring
In the sample below I’ve done this. Also added some variety you can try out
use differnt synths . ;fm is good. Try others.Add density function to get more interesting snap rhythm. Change the dice(20 to dice(1) to play orginal
add changes in pan setting (comment out end of line if yoiu want to swithchit out)
add optional use_transpose (try -12,0 or 12)

use_bpm 100

live_loop :crotchet do
  density dice(2) do
    sample :perc_snap#,pan: (-1)**dice(2)
    sleep 1
  end
end

blues_scale = (ring 60, 60, 51, 52, 53, 54, 55)
durs=(ring 0.5,1,1,1,1,0.5,1)

live_loop :blueRiff do
  use_synth :fm
  use_transpose 0 #try -12 or 12
  use_synth_defaults release: 0.5,amp: 4
  play blues_scale.tick #tick advances to next note each pass of the loop
  sleep durs.look #look gives same as tick value without advancing it
end
2 Likes

ring! Of course, much more elegant and flexible, many thanks

Having waaay too much fun with .shuffle, .mirror etc on those rings :smiley:

2 Likes

this is seriously groovy!