Meandering chord progressions and melody through Sonic Pi scales

I was looking at some of @mrbombmusic tutorials on youtube which are a good start to start playing with ideas, and developed one of them to produce the piece below. It can easily be altered or developed further.

#chord progressions and melody meandering through Sonic Pi's scales
#code by Robin Newman, inspired by a tutorial by Mr Bomb
#https://www.youtube.com/watch?v=QeDm_8r1-bQ

use_debug false
use_bpm 110

sn= scale_names #internally defined scale names in Sonic Pi

define :dub do |n| #n is a list of notes
  #list n is duplicated an octave above and below the original
  #a rest (nil) is added to the list
  op=[nil] #output list initiated to a rest (nil) to add some rhythmic change to what is played
  n.each do |nv|
    op += [nv] #original
    op += [nv - 12] #down an octave
    op += [nv + 12] #up an octave
  end
  return op #expanded list is returned
end

with_fx :reverb, room: 0.6,mix: 0.7 do
  live_loop :prog do
    use_synth :pluck #for melody notes
    #choose one of the two progressions. Could add others
    progression = [(ring, :i,:vi,:ii,:v),(ring, :i, :v,:vi,:iv)].choose
    puts progression
    s=scale_names.choose #.tick can be used instead to sequence through them all
    puts s
    tick_reset :prog #reset tick counter :prog
    progression.length.times do #iterate through the progression
      #take three note chord for each degree
      cn=chord_degree(progression.tick(:prog),:c4,s,3)
      in_thread do #individual note thread played at same time as chord
        cx=dub(cn) #produced extended list using dub
        puts cx
        16.times do #play 16 notes/rests from the list
          play cx.choose,pan: rrand_i(-1,1)  #distribute note to pan -1,0 or 1
          sleep 0.25
        end
      end
      with_synth :tb303 do
        #play the next chord in the progression
        play cn,release: 4,cutoff: 90,amp: 0.5,pan: rrand_i(-1,1)
      end
      sleep 4
    end
  end
end#reverb
2 Likes

Thank You …
Good YouTubes … AND
Your piece is delightful …
" Artificial Musical Intelligence "
is a great possibility with scripted
audio . The most interesting facet
( to me ) being the interaction of
mind ( perception ) with the
performance . One man ’ s
( or moment ’ s ) music is
the next man ’ s ( or moment ’ s )
noise …

@robin.newman Some of my recent posts reveal that this is a favourite topic of mine - constrained randomisation for harmony and melody, and improvising with code. I plan to dissect, adapt and understand this excellent example of yours. One day, I too will know Kung Fu.

PD-Pi