#Sing along with great jubilation and excitement!! #globals ##keys to switch between. Don't think it will work with ##can work with other keys but transposition might be off ##Probably works best when keys are a fourth apart keys = [:D4, :A3] relative = [:minor, :major] #works well with :mod_square, :mod_saw, etc use_synth :mod_sine in_thread do # locals idx = 0 deg = 1 rel = relative[0] define :next_chord do |root| #minor rules if rel == relative[0] if root == 1 return choose([2,3,4,6,7]) end if root == 2 return 5 end if root == 3 return choose ([4,6]) end if root == 4 return choose ([2,5]) end if root == 5 n=2 n=choose([1,2,6]) if n == 2 idx = 1 rel = relative[1] return 5 end return n end if root == 6 #also nice with 7 surprisingly! return choose([4,7]) end if root == 7 return 3 end end ##major rules if rel == relative[1] if root == 1 n = choose([2,3,4,5,6]) return n end if root == 2 #technically iv is not normative, #but this establishes the key better #with the D major chord #plus every progression must have some regression #to make a convincing plot :) return choose([4,5]) end if root == 3 return choose ([4,6]) end if root == 4 return choose ([1,2,5]) end if root == 5 n=choose([1,2,6]) if n == 2 idx = 0 rel = relative[0] return 5 end return n end if root == 6 return 4 end end end with_fx :compressor, amp: 0.7 do live_loop :infinite_progression do puts deg puts keys[idx] puts rel 4.times do if deg == 5 and rel == relative[0] 2.times do play (chord_degree deg, keys[idx], :harmonic_minor, 3), amp: 0.6, sustain: 0.1 sleep 0.5 end else play (chord_degree deg, keys[idx], rel, 3), amp: 0.6, sustain: 0.1 sleep 0.5 end end deg = next_chord deg end end end