Skip to content

Instantly share code, notes, and snippets.

@jraregris
Created September 1, 2012 11:05
Show Gist options
  • Save jraregris/3569872 to your computer and use it in GitHub Desktop.
Save jraregris/3569872 to your computer and use it in GitHub Desktop.
Bass buttons on my brother's accordion
module Accordion
TONES = ['C ', 'C#', 'D ', 'D#', 'E ', 'F ', 'F#', 'G ', 'G#', 'A ', 'A#', 'B ']
def get_tone t
TONES[t%12]
end
def rel tone, dist
get_tone((TONES.find_index(tone) + dist) % 12)
end
def line tone
[8,4,0].collect {|i| rel tone, i}
end
end
include Accordion
def pline a
a.each { |i| print "#{i} "}
print "\n"
end
# %W(C F G).each { |t| pline line t}
i = 10
20.times do
pline line TONES[i%12]
i += 5
end
@jraregris
Copy link
Author

F#  D   A#
B   G   D#
E   C   G#
A   F   C#
D   A#  F#
G   D#  B
C   G#  E
F   C#  A
A#  F#  D
D#  B   G
G#  E   C
C#  A   F
F#  D   A#
B   G   D#
E   C   G#
A   F   C#
D   A#  F#
G   D#  B
C   G#  E
F   C#  A

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment