Sha256: 62dcbcf46ec44049f32ffebfea3c24319f4a8f8fd9aaa7967001934ba29af191
Contents?: true
Size: 597 Bytes
Versions: 16
Compression:
Stored size: 597 Bytes
Contents
# frozen_string_literal: true # Octave equivalence is the functional equivalence of pitches with the same spelling separated by one or more octaves. class HeadMusic::Pitch::OctaveEquivalence def self.get(pitch) @octave_equivalences ||= {} @octave_equivalences[pitch.to_s] ||= new(pitch) end attr_reader :pitch def initialize(pitch) @pitch = pitch end def octave_equivalent?(other) other = HeadMusic::Pitch.get(other) pitch.spelling == other.spelling && pitch.octave != other.octave end alias equivalent? octave_equivalent? private_class_method :new end
Version data entries
16 entries across 16 versions & 1 rubygems