Skip to content

Commit

Permalink
added a fix for aliases, but now specs pass.... they shouldn't, but t…
Browse files Browse the repository at this point in the history
…hey do...
  • Loading branch information
jwoertink committed Jun 16, 2016
1 parent 0d2760d commit 0bbe77f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/medley/notes.cr
@@ -1,7 +1,9 @@
module Medley
class Notes
NOTE_NAMES = %w(A B C D E F G)
ALIASES = {"B#": "C", "Cb": "B", "E#": "F", "Fb": "E"}
ALIASES = {"B#": "C", "Cb": "B", "E#": "F", "Fb": "E",
"A#": "Bb", "Bb": "A#", "C#": "Db", "Db": "C#",
"D#": "Eb", "Eb": "D#", "F#": "Gb", "Gb": "F#"}

def initialize(current_note : String)
@current_note = current_note
Expand Down
14 changes: 11 additions & 3 deletions src/medley/scales.cr
Expand Up @@ -24,12 +24,20 @@ module Medley
note = Medley::Notes.new(@root)
@notes << note.name
@pattern.each do |step|
case step
new_note = case step
when "1"
@notes << note.wholestep_up
note.wholestep_up
when ".5"
@notes << note.halfstep_up
note.halfstep_up
else
""
end
# TODO: find a better way to handle this
# need to do this because if the scale has A and A#, the A# should be Bb
#if @notes.select { |n| n[0].to_s == new_note[0].to_s }.any?
# new_note = Medley::Notes::ALIASES[new_note]
#end
@notes << new_note
note = Medley::Notes.new(@notes.last)
end
end
Expand Down

0 comments on commit 0bbe77f

Please sign in to comment.