Sonic Pi Inspiration: And today’s thought is…..

I like the way that a sudden thought or a read comment can provide an inspiration to do something creative with Sonic Pi. It is such a versatile program that this can take many forms, and you never really know where the next area of inspiration will come from.

Recently I have concentrated on adding to the repertoire of SP programs which play 16th century baroque pieces, the most recent two being Samuel Scheidt’s Canzon Cornetto with code gist here
and Salamone Rossi’s Seven Correnti with code gist here

I noticed a few days ago that Joseph Wilk had added a function called invert_chord to SP dev 2.6 which returns chord inversions. I remembered doing something similar (although not as elegantly as his recursive version) nearly two years ago, when I sent some time playing with chord inversions, chord progressions and various types of cadences. (as an aside Sonic Pi has great potential in supporting a study of music theory, and I think could be very useful in providing support material for the Grade 5 Theory exam, which all instrumentalists have to pass before progressing to higher grades of achievement on their chosen instrument).

I wrote separate functions for first second and third inversions, whereas Joseph has succinctly packed them into one definition. Anyway, this got me thinking on the subject again. Since my first foray the functions for chord_degrees had been added to Sonic Pi, and I also decided to explore this. I find that some of these more obscure functions can provide a rich source of experimentation. After some playing around I ended up with a one or two functions which I share here.

They include
playharmonyscale which lets you play up to three octaves of a harmonised scale starting on a note which you specify. The function can play both ascending and descending scales. The range of course is restricted on the starting note. You can’t do three octaves ascending from C6!

The second function called degprogress will play a specified number of chords in sequence using different degrees of the given scale. Examples are given for C; major and for producing a sequence from three pentatonic scales

The third function explores a circle progression of chords. You can specify the starting note and the duration of each chord separately in the progression

The final example in the program file plays an example based on 1st, second, third and fourth inversion triads, producing quite a nice end result.

You can hear these at
with the gist code here

The final example is also published separately in a program called ripples.rb

with Gist code here

Having got the inspiration to explore chord sequences, i was led on to take a look at teh sequencies involved in “boogie”. After some playing around I came up with a piece called…you guessed it boogie.rb

This is published at
with the associated Gist code here

I hope you enjoy these. All the programs contain comments giving some detail of their operation.