Sha256: 85bb73bb04ac3435e21ce988b4716bb59568a9b3e1c5e78071b46f822814f15c
Contents?: true
Size: 1015 Bytes
Versions: 21
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
21 entries across 21 versions & 1 rubygems
Version | Path |
---|---|
head_music-0.19.1 | lib/head_music/style/guidelines/prepare_octave_leaps.rb |