Sha256: 1a574d59fb6061d91e42d1045fb3014fb4ebecacbdb5892a152be784df57a357

Contents?: true

Size: 710 Bytes

Versions: 9

Compression:

Stored size: 710 Bytes

Contents

class HeadMusic::MelodicInterval
  attr_reader :voice, :first_note, :second_note

  def initialize(voice, note1, note2)
    @voice = voice
    @first_note = note1
    @second_note = note2
  end

  def functional_interval
    @functional_interval ||= HeadMusic::FunctionalInterval.new(first_note.pitch, second_note.pitch)
  end

  def position_start
    first_note.position
  end

  def position_end
    second_note.next_position
  end

  def notes
    [first_note, second_note]
  end

  def pitches
    notes.map(&:pitch)
  end

  def to_s
    [direction, functional_interval].join(' ')
  end

  def method_missing(method_name, *args, &block)
    functional_interval.send(method_name, *args, &block)
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
head_music-0.11.9 lib/head_music/melodic_interval.rb
head_music-0.11.8 lib/head_music/melodic_interval.rb
head_music-0.11.7 lib/head_music/melodic_interval.rb
head_music-0.11.6 lib/head_music/melodic_interval.rb
head_music-0.11.5 lib/head_music/melodic_interval.rb
head_music-0.11.4 lib/head_music/melodic_interval.rb
head_music-0.11.3 lib/head_music/melodic_interval.rb
head_music-0.11.2 lib/head_music/melodic_interval.rb
head_music-0.11.1 lib/head_music/melodic_interval.rb