A js implementation of this: http://rubyquiz.strd6.com/quizzes/229-music-theory