Sha256: bb161155f057e7b10b27de21b2906ffd6a1ab263e63555a2082dfd6e9041d981
Contents?: true
Size: 1015 Bytes
Versions: 9
Compression:
Stored size: 1015 Bytes
Contents
# frozen_string_literal: true # Module for style guidelines. module HeadMusic::Style::Guidelines; end # A counterpoint guideline class HeadMusic::Style::Guidelines::PrepareOctaveLeaps < HeadMusic::Style::Annotation MESSAGE = "Enter and exit an octave leap from within." def marks (external_entries + external_exits + octave_ending).map do |trouble_spot| HeadMusic::Style::Mark.for_all(trouble_spot) end end private def external_entries melodic_intervals.each_cons(2).map do |pair| first, second = *pair pair.map(&:notes).uniq if second.octave? && !second.spans?(first.first_note.pitch) end.compact end def external_exits melodic_intervals.each_cons(2).map do |pair| first, second = *pair pair.map(&:notes).uniq if first.octave? && !first.spans?(second.second_note.pitch) end.compact end def octave_ending octave_ending? ? [melodic_intervals.last.notes] : [] end def octave_ending? melodic_intervals.last&.octave? end end
Version data entries
9 entries across 9 versions & 1 rubygems