Class: HeadMusic::Rudiment::Spelling::EnharmonicEquivalence
- Inherits:
-
Object
- Object
- HeadMusic::Rudiment::Spelling::EnharmonicEquivalence
- Defined in:
- lib/head_music/rudiment/spelling.rb
Overview
Enharmonic equivalence occurs when two spellings refer to the same pitch class, such as D# and Eb.
Instance Attribute Summary collapse
-
#spelling ⇒ Object
readonly
Returns the value of attribute spelling.
Class Method Summary collapse
Instance Method Summary collapse
- #enharmonic_equivalent?(other) ⇒ Boolean (also: #enharmonic?, #equivalent?)
-
#initialize(spelling) ⇒ EnharmonicEquivalence
constructor
A new instance of EnharmonicEquivalence.
Constructor Details
#initialize(spelling) ⇒ EnharmonicEquivalence
Returns a new instance of EnharmonicEquivalence.
107 108 109 |
# File 'lib/head_music/rudiment/spelling.rb', line 107 def initialize(spelling) @spelling = HeadMusic::Rudiment::Spelling.get(spelling) end |
Instance Attribute Details
#spelling ⇒ Object (readonly)
Returns the value of attribute spelling.
105 106 107 |
# File 'lib/head_music/rudiment/spelling.rb', line 105 def spelling @spelling end |
Class Method Details
Instance Method Details
#enharmonic_equivalent?(other) ⇒ Boolean Also known as: enharmonic?, equivalent?
111 112 113 114 |
# File 'lib/head_music/rudiment/spelling.rb', line 111 def enharmonic_equivalent?(other) other = HeadMusic::Rudiment::Spelling.get(other) spelling != other && spelling.pitch_class_number == other.pitch_class_number end |