Class: HeadMusic::Rudiment::Spelling::EnharmonicEquivalence

Inherits:
EnharmonicEquivalence show all
Defined in:
lib/head_music/rudiment/spelling/enharmonic_equivalence.rb

Overview

Enharmonic equivalence occurs when two spellings refer to the same pitch class, such as D# and Eb.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

This class inherits a constructor from HeadMusic::Rudiment::EnharmonicEquivalence

Class Method Details

.subject_classObject



3
4
5
# File 'lib/head_music/rudiment/spelling/enharmonic_equivalence.rb', line 3

def self.subject_class
  HeadMusic::Rudiment::Spelling
end

Instance Method Details

#enharmonic_equivalent?(other) ⇒ Boolean

Returns:

  • (Boolean)


9
10
11
12
# File 'lib/head_music/rudiment/spelling/enharmonic_equivalence.rb', line 9

def enharmonic_equivalent?(other)
  other = HeadMusic::Rudiment::Spelling.get(other)
  spelling != other && spelling.pitch_class_number == other.pitch_class_number
end