Skip to content

Instantly share code, notes, and snippets.

@alexwebr
Created July 2, 2015 21:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexwebr/0b384f83b41b0eadea4f to your computer and use it in GitHub Desktop.
Save alexwebr/0b384f83b41b0eadea4f to your computer and use it in GitHub Desktop.
dust_in_the_wind.rb
# Iterates through its elements, starting at the beginning, forever.
class CircularList
def initialize values
@values = values
@index = 0
end
def next
value = @values[@index]
@index += 1
@index = 0 if @index == @values.length
value
end
end
def pick strings
finger_for_string = {
2 => :thumb,
3 => :thumb,
4 => :index,
5 => :middle
}
strings = [strings] if not strings.is_a? Array
puts "Pick #{strings.join(", ")} with #{strings.map { |s| finger_for_string[s] }.join(", ")}"
end
# "Travis pick" fingerpicking pattern. 7 notes total.
def travis_pattern
(1..2).each do |x|
if x == 1
pick [2, 5]
else x == 2
pick 2
pick 5
end
pick 3
pick 4
end
end
chord = "C"
fifth_string = CircularList.new [1, "0/open", 3]
(1..4).each do
puts "=== CHORD CHANGE: Switch to #{chord}"
(1..4).each do
puts "Chord #{chord} with 5th string at #{fifth_string.next}"
travis_pattern
end
chord = case chord
when "A" then "C"
when "C" then "A"
end
end
=== CHORD CHANGE: Switch to C
Chord C with 5th string at 1
Pick 2, 5 with thumb, middle
Pick 3 with thumb
Pick 4 with index
Pick 2 with thumb
Pick 5 with middle
Pick 3 with thumb
Pick 4 with index
Chord C with 5th string at 0/open
Pick 2, 5 with thumb, middle
Pick 3 with thumb
Pick 4 with index
Pick 2 with thumb
Pick 5 with middle
Pick 3 with thumb
Pick 4 with index
Chord C with 5th string at 3
Pick 2, 5 with thumb, middle
Pick 3 with thumb
Pick 4 with index
Pick 2 with thumb
Pick 5 with middle
Pick 3 with thumb
Pick 4 with index
Chord C with 5th string at 1
Pick 2, 5 with thumb, middle
Pick 3 with thumb
Pick 4 with index
Pick 2 with thumb
Pick 5 with middle
Pick 3 with thumb
Pick 4 with index
=== CHORD CHANGE: Switch to A
Chord A with 5th string at 0/open
Pick 2, 5 with thumb, middle
Pick 3 with thumb
Pick 4 with index
Pick 2 with thumb
Pick 5 with middle
Pick 3 with thumb
Pick 4 with index
Chord A with 5th string at 3
Pick 2, 5 with thumb, middle
Pick 3 with thumb
Pick 4 with index
Pick 2 with thumb
Pick 5 with middle
Pick 3 with thumb
Pick 4 with index
Chord A with 5th string at 1
Pick 2, 5 with thumb, middle
Pick 3 with thumb
Pick 4 with index
Pick 2 with thumb
Pick 5 with middle
Pick 3 with thumb
Pick 4 with index
Chord A with 5th string at 0/open
Pick 2, 5 with thumb, middle
Pick 3 with thumb
Pick 4 with index
Pick 2 with thumb
Pick 5 with middle
Pick 3 with thumb
Pick 4 with index
=== CHORD CHANGE: Switch to C
Chord C with 5th string at 3
Pick 2, 5 with thumb, middle
Pick 3 with thumb
Pick 4 with index
Pick 2 with thumb
Pick 5 with middle
Pick 3 with thumb
Pick 4 with index
Chord C with 5th string at 1
Pick 2, 5 with thumb, middle
Pick 3 with thumb
Pick 4 with index
Pick 2 with thumb
Pick 5 with middle
Pick 3 with thumb
Pick 4 with index
Chord C with 5th string at 0/open
Pick 2, 5 with thumb, middle
Pick 3 with thumb
Pick 4 with index
Pick 2 with thumb
Pick 5 with middle
Pick 3 with thumb
Pick 4 with index
Chord C with 5th string at 3
Pick 2, 5 with thumb, middle
Pick 3 with thumb
Pick 4 with index
Pick 2 with thumb
Pick 5 with middle
Pick 3 with thumb
Pick 4 with index
=== CHORD CHANGE: Switch to A
Chord A with 5th string at 1
Pick 2, 5 with thumb, middle
Pick 3 with thumb
Pick 4 with index
Pick 2 with thumb
Pick 5 with middle
Pick 3 with thumb
Pick 4 with index
Chord A with 5th string at 0/open
Pick 2, 5 with thumb, middle
Pick 3 with thumb
Pick 4 with index
Pick 2 with thumb
Pick 5 with middle
Pick 3 with thumb
Pick 4 with index
Chord A with 5th string at 3
Pick 2, 5 with thumb, middle
Pick 3 with thumb
Pick 4 with index
Pick 2 with thumb
Pick 5 with middle
Pick 3 with thumb
Pick 4 with index
Chord A with 5th string at 1
Pick 2, 5 with thumb, middle
Pick 3 with thumb
Pick 4 with index
Pick 2 with thumb
Pick 5 with middle
Pick 3 with thumb
Pick 4 with index
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment