class HeadMusic::KeySignature::EnharmonicEquivalence
Key signatures are enharmonic when all pitch classes in one are respellings of the pitch classes in the other.
Attributes
key_signature[R]
Public Class Methods
get(key_signature)
click to toggle source
# File lib/head_music/key_signature.rb, line 111 def self.get(key_signature) key_signature = HeadMusic::KeySignature.get(key_signature) @enharmonic_equivalences ||= {} @enharmonic_equivalences[key_signature.to_s] ||= new(key_signature) end
Private Class Methods
new(key_signature)
click to toggle source
# File lib/head_music/key_signature.rb, line 119 def initialize(key_signature) @key_signature = HeadMusic::KeySignature.get(key_signature) end
Public Instance Methods
enharmonic_equivalent?(other)
click to toggle source
# File lib/head_music/key_signature.rb, line 123 def enharmonic_equivalent?(other) other = HeadMusic::KeySignature.get(other) (key_signature.signs | other.signs).map(&:to_s).uniq.length == 12 end
Also aliased as: enharmonic?, equivalent?