class HeadMusic::Spelling::EnharmonicEquivalence
Enharmonic equivalence occurs when two spellings refer to the same pitch class, such as D# and Eb.
Attributes
spelling[R]
Public Class Methods
get(spelling)
click to toggle source
# File lib/head_music/spelling.rb, line 100 def self.get(spelling) spelling = HeadMusic::Spelling.get(spelling) @enharmonic_equivalences ||= {} @enharmonic_equivalences[spelling.to_s] ||= new(spelling) end
Private Class Methods
new(spelling)
click to toggle source
# File lib/head_music/spelling.rb, line 108 def initialize(spelling) @spelling = HeadMusic::Spelling.get(spelling) end
Public Instance Methods
enharmonic_equivalent?(other)
click to toggle source
# File lib/head_music/spelling.rb, line 112 def enharmonic_equivalent?(other) other = HeadMusic::Spelling.get(other) spelling != other && spelling.pitch_class_number == other.pitch_class_number end
Also aliased as: enharmonic?, equivalent?