Skip to content

Instantly share code, notes, and snippets.

@xavriley
Last active November 15, 2022 19:34
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save xavriley/31f9af4258d5771b3c21 to your computer and use it in GitHub Desktop.
Save xavriley/31f9af4258d5771b3c21 to your computer and use it in GitHub Desktop.
Using Sonic Pi to practice guitar

Using Sonic Pi to practice guitar

This is an implementation of a scale exercise widely used in jazz teaching. It's sometimes known as the "big scale" exercise.

Explanation

Let's say you practice the saxophone and you want to make sure you know all your major scales. One way to test this would be to play the scale within the limits of your instrument - saxophones have a lowest note and a highest note (from :Db3 to :A5 at concert pitch in Sonic-Pi speak - see here http://en.wikipedia.org/wiki/Alto_saxophone#Range - assuming you don't get fancy with harmonics!)

Playing an Eb major scale over the whole range of the instrument would mean playing from :D3 to Ab5 (concert) as the lowest and highest notes available don't appear in the scale (:Db3 and :A5 respectively). When you hit the upper or lower limit you just reverse the direction and carry on going.

Typically, you play a set number of bars for each scale - in this example it's 4 bars. On the next four bars you switch to the nearest available note in the new scale, indicated in the list shown in the output window.

This exercise really keeps you on your toes! It takes a lot of practice to make sure your fingers naturally shift to the next scale pattern and it's good training for switching up scales in jazz improvisation.

On the guitar

The problem with the guitar is that the range of the instrument is huge - :E2 to :B6! The added problem is that there are a million different fingering patterns to navigate between those notes because the same notes appear on different strings (not like a piano or a saxophone (for the most part) where each note occurs in one place).

One solution - take the range as being the most your fingers can play in one position. In the example below, that means using frets 1 - 5 with no open strings which should give a range of :F2 to :A4

If you can play all the scales without moving position that will give you 12 "shapes" that will let you switch between any scales anywhere on the guitar. It's very liberating when you get used to it!

Credit

I was taught this exercise by Mike Walker who is one of the greatest jazz guitarists alive today. He's an excellent teacher and he's put together an instructional site called Practisin2Play which describes this exercise and hundreds of others - well worth a look for anyone into jazz guitar!

uncomment do
define :scale_range do |note, scale_type, low, high|
my_scale = scale(note(note, :octave => 1), scale_type, num_octaves: 7)
my_scale = my_scale.to_a.delete_if {|x| x < note(low) || x > note(high) }
[my_scale + my_scale.reverse[1..-2]].flatten
end
# Useful for checking which notes are in the scales
# puts scale(:c, :melodic_major).map {|x| SonicPi::Note.resolve_note_name(x) }
# Issues
# - Doesn't work with small nos of bars at the moment
use_debug false
use_bpm 140
use_synth :dsaw
use_synth_defaults sustain: 0.15, release: 0.1
# SETTINGS
@scale_type = [:major,
:melodic_minor_asc,
:minor_pentatonic,
:hex_major7,
:hex_dorian][0] # These are the scales I typically practice
@low_note = :f2
@high_note = :a4
@no_of_bars = 4 # doesn't work with less than 4 atm
# END SETTINGS
@last_note = (note(@low_note) - 1) # lets the scale "find" the starting note
@dir = :up
scale_roots = [:c, :db, :d, :eb, :e, :f, :gb, :g, :ab, :a, :bb, :b].shuffle
# look in the output window to see the order the scales get played in
puts scale_roots
4.times {
sample :drum_cymbal_closed
sleep 1
}
scale_roots.map {|n|
scale_range(n, @scale_type, @low_note, @high_note).take(8 * @no_of_bars)
}.each do |my_scale|
@my_scale = my_scale
# guards to stop it getting 'stuck'
@dir = :down if @last_note == @my_scale.max
@dir = :up if @last_note == @my_scale.min
if @dir == :up
while (@my_scale.first <= @last_note)
@my_scale.rotate!
end
else
@my_scale.rotate!((@my_scale.length/2).ceil)
while @my_scale.first >= @last_note
@my_scale.rotate!
end
end
sample :perc_bell, amp: 0.4 # mark change of scale
@my_scale.cycle.take(8 * @no_of_bars).each do |note|
if note >= @last_note
@dir = :up
else
@dir = :down
end
@last_note = note
play @last_note
sleep 0.5
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment