Using Chord Inversion to Smooth a Chord Progression
Thanks to @kniknoo for revealing the Chord Degree function.
The following code is based on music theory YouTube videos by Michael New.
In this one he talks about chord inversions and using them to smoooth out chord progressions.
So here is some code that smooths out a chord progression. Perhaps you can use it to do the same to your favorite chord progression.
#ChordProgression.rb
# 14 Oct 2017
# Idea from watching one of Michael New's Music Theory Videos
# Using chord inversion to make chord progressions smooth
#https://www.youtube.com/watch?v=Nr2XBoanNJY&list=PLTKhUdPIHIuhhCrMuKJWcjnXUfAN3f5Mn&index=6
# note that he starts numbering inversions at 1
#Sonic Pi starts at 0
##############
#helper function
def midi2note(n)
nn=note(n)
if nn==nil
return nn
else
nn= note_info(nn)
nnn=nn.to_s.split(":")
mmm= nnn[3].chop
return mmm
end
end # midi2note
def listnotes(n)
i=0
while i<n.length
puts midi2note(n[i])
i+=1
end
end
#Define tempo and note lengths and release fraction
#####
tempo=1.0 ### try changing tempo
#define note timings
whole=1.0
half=whole/2.0
dothalf=half*1.5
quart=half/2.0
dotquart=quart*1.5
eighth=quart/2.0
doteighth=eighth*1.5
sixteenth=eighth/2
#########
use_synth :fm
with_fx :level, amp: 0.3 do
### try different keys
key= note(:e4)
puts midi2note(key)
puts " "
### try major
mode=:minor
i=0
while i<5
a=chord_invert(chord_degree :i, key, mode,3),0
listnotes(a)
play a
sleep quart*tempo
a=chord_invert(chord_degree :vi, key-12, mode,3),1
listnotes(a)
play a
sleep quart*tempo
a=chord_invert(chord_degree :ii, key-12, mode,3),2
listnotes(a)
play a
sleep quart*tempo
a=chord_invert(chord_degree :v, key-12, mode,3),2
listnotes(a)
play a
sleep quart*tempo
i+=1
end
a=chord_invert(chord_degree :i, key, mode,3),0
listnotes(a)
play a
sleep quart*tempo
end