Open HRoude opened 9 years ago
def pitch_class note
notes = { "C" => 0, "D" => 2, "E" => 4, "F" => 5, "G" => 7, "A" => 9, "B" => 11 }
value = notes[note]
if note.length > 1
if note.include? "#"
notes[note[0]] + 1
else note.include? "b"
notes[note[0]] - 1
end
elsif !note.match(/^[A-G]b?#?$/)
puts "nil"
else note.length == 1
value
end
end
Assignment:
If you are comfortable with the how-to stuff like Treehouse and Code School, you'll be fine. The JavaScript Garden is really only for those who have some JS experience, or who want a lot of it.
Reading :