Polyphonic/polyrhythmic sequencing


#1

After working on generative sequencing with Sonic Pi for a while I started trying out more straightforward sequencing. Have a look at this three-part sequencing code. You can play it globally by just changing the random_seed R, or by changing the random seed of the thread which is defining the pitches which are to be used (which are microtonal).
Or you can adjust the settings of each of the three pattern generating live_loops.

I guess it would be fun to control the respective parameters with a midi controller but I did not try to make that work.

Enjoy!

#Seed Sequencing w selected pitches

in_thread do
  use_random_seed 6 #changing the random_seed changes the pitches to be used by the patterns
  set :eins, rrand(60, 72)
  set :zwei, rrand(60, 72)
  set :drei, rrand(60, 72)
  set :vier, rrand(60, 72)
  set :fünf, rrand(60, 72)
  sleep 1
end



live_loop :pattern1 do
  use_bpm 60 #try 60.1 for phasing á la Steve Reich
  use_synth :sine
  R = 1 #setting the random seed
  use_random_seed R
  set :x, 16 #setting the length of the first pattern
  get[:x].times do
    set :a, [get[:eins], get[:zwei], get[:drei], get[:vier], get[:fünf]].choose
    if rand < 0.2 #setting the density; 0 = no notes, 1 = maximum notes
      play get[:a], amp: rrand(0.5, 1), sustain: 0.1, release: 0.2, pan: - 0.5
    end
    sleep 0.125
  end
  #sleep 1.5 #if a break between pattern repetitions is desired
end


live_loop :pattern2 do
  use_bpm 60
  use_synth :sine
  use_random_seed R + 1 #setting a relation to the random seed
  set :x, 12 #setting the length of the second pattern
  get[:x].times do
    set :a1, [get[:eins], get[:zwei], get[:drei], get[:vier], get[:fünf]].choose
    if rand < 0.3 #setting the density; 0 = no notes, 1 = maximum notes
      play get[:a1], amp: rrand(0.5, 1), sustain: 0.1, release: 0.2, pan: 0.5
    end
    sleep 0.125
  end
  #sleep 1.5 #if a break between pattern repetitions is desired
end

live_loop :pattern3 do
  use_bpm 60
  use_synth :sine
  use_random_seed R + 2 #setting a relation to the random seed
  set :x, 12 #setting the length of the third pattern
  get[:x].times do
    set :a2, [get[:eins], get[:zwei], get[:drei], get[:vier], get[:fünf]].choose
    if rand < 0.2 #setting the density; 0 = no notes, 1 = maximum notes
      play get[:a2] - 12, amp: rrand(0.5, 1), sustain: 0.1, release: 0.2, pan: 0
    end
    sleep 0.125
  end
  sleep 1.5 #if a break between pattern repetitions is desired
end