Module: Musicality::Parsing::Key::Key1
- Defined in:
- lib/musicality/notation/parsing/key_parsing.rb
Instance Method Summary collapse
Instance Method Details
#to_key ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/musicality/notation/parsing/key_parsing.rb', line 31 def to_key sem = pitch_letter.to_semitone modval = 0 if !mod.empty? modval = case mod.text_value when "#" then 1 when "b" then -1 end end triad_type = if major_minor.text_value.include?("maj") Musicality::Key::MAJOR else Musicality::Key::MINOR end return Musicality::Key.new(sem + modval, triad_type: triad_type) end |