# Arpeggios based on circle of fifths

This piece was inspired by the page

https://musiclab.chromeexperiments.com/Arpeggios/
from Google’s Chrome Music Lab on that page you can play arpeggios from the circle of fifths, and you can alter the patter with which the arpeggios are played. One of them uses a 2 part harmony. I took the note pattern for this and wrote a function to play it, and then put together a live loop to play selections from the circle of fifths.
I added various bits to this, including the facility to alter the minor arpeggios by flattening the second note even further (2 semitones instead of one) which sounded nice. I also transposed the whole pattern after each 4 pair of arpeggios had been lplayed suing a sequence `(ring 0,-5,7,12,7,-5)`

The end result is shown below.

``````#Circle of Fifths and Arpeggios by Robin newman, June 2018

define  :arp do |n,m=0,r=false| #n is base note,m is minor offset,r is reverse arpeggio (when true)
c1=[0,4-m,7,12,7,4-m]*2 #part 1 note offsets
c2=[7,12,16-m,19,16-m,19,24,19,24,28-m,24,19]*2 #part 2 note offsets
if r==true #can reverse play direction using r
c1=c1.reverse
c2=c2.reverse
end
12.times do |i|
play note(n)+c1[i],release: 1.0/3 ,cutoff: rrand(70,120)#3 notes per beat
play note(n)+c2[i],release: 1.0/3,cutoff: rrand(70,120)
sleep 1.0/3
end
end

with_fx :reverb,room: 0.8,mix: 0.6 do
live_loop :pl do
use_bpm 120
use_transpose (ring 0,-5,7,12,7,-5)[look(:tr) / 4]   #change every 4th pass of the loop
use_synth :tb303
tick(:b) #ticks next base note for arpeggio
bmaj=(ring :c3,:g3,:d3,:a3,:e3,:b3,:fs3,:cs3,:gs3,:ds3,:as3,:f3).look(:b)
play note(bmaj)-12 ,sustain:  3.5,release: 0.5,cutoff: rrand(60,100),amp: 0.7
end
dir=rand_i
arp(bmaj,0,dir) #play major arpeggios
#tick(:b) if dice(4)==1 #sometimes advance another note in sequence (optional)
bmin=(ring :a3,:e3,:b3,:fs3,:cs3,:gs3,:ds3,:as3,:f3,:c3,:g3,:d3).look(:b)
play note(bmin)-12 ,sustain: 3.5,release: 0.5,cutoff: rrand(60,100),amp: 0.7
end
arp(bmin,dice(2),dir) #play minor arpeggio, with random factor for "3rd"
##| tick(:b) if dice(2)==1 #sometimes advance anoterh note in sequence (optional)
if rt(vt) >=192 #start coda
puts "start coda.."
use_transpose 0
7.times do |j|
base=[:c3,:a3,:e3,:d3,:f3,:g3,:c3]
min=[0,1,1,1,0,0,0]
play note(base[j])-12 ,sustain:  3.5,release: 0.5,cutoff: rrand(60,100),amp: 0.7
end
arp(base[j],min[j])
end
play [:c2,:c3,:e3,:g3,:c4],sustain: 2,release: 10,cutoff: 80,amp: 1
stop
end
end
end
``````

You can hear the piece on soundcloud

6 Likes

I LOVE Chrome Music Lab. So great to see a crossover project with Sonic Pi!!

Sounds nice, I like it. It’s a good script to play with different sequences of major-minor chords. That’s what I do when exercising on the piano.

I try going clock-wise or anti-clock-wise to brighten or darken the sound. And the smoothest sound is by only changing one note at a time.

Example:
Starting in “C major” and only changing one note gets you either “Am” or “Em”.

Changing one note in “Am” gets you “F major” -> going anti-clock-wise.

``````bmaj=(ring :c3,:f3,:bb3,:eb3,:ab3,:db3,:gb3,:b3,:e3,:a3,:d3,:g3).look(:b) # dark
bmin=(ring :a3,:d3,:g3,:c3,:f3,:bb3,:eb3,:gs3,:cs3,:fs3,:b3,:e3).look(:b) # dark
``````

Changing one note in “Em” gets you “G major” -> going clock-wise.

``````bmaj=(ring :c3,:g3,:d3,:a3,:e3,:b3,:fs3,:db3,:ab3,:eb3,:bb3,:f3).look(:b) # bright
bmin=(ring :e3,:b3,:fs3,:cs3,:gs3,:eb3,:bb3,:f3,:c3,:g3,:d3,:a3).look(:b) # bright
``````

These are great alternatives. Thanks for sharing them. Really enjoyed it.