Skip to content

Instantly share code, notes, and snippets.

@iamsolarpowered
Created March 25, 2012 07:59
Show Gist options
  • Save iamsolarpowered/2192283 to your computer and use it in GitHub Desktop.
Save iamsolarpowered/2192283 to your computer and use it in GitHub Desktop.
12-Bar Blues in Ruby
module Play
def self.note note = nil
@note = note.to_s.upcase
self
end
def self.for bars = 1, length = 1
bars.times do
puts @note
sleep length
end
end
end
class Integer
def bar note
Play.note(note).for(self)
end
alias :bars :bar
end
# Just in E for now
12.times do
4.bars :e
2.bars :a
2.bars :e
1.bar :b
1.bar :a
1.bar :e
1.bar :b
end
puts 'Goodnight!'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment