Sha256: 64cbcad41833257444818682878f01a158ec740344db99a90895955eb11498f3
Contents?: true
Size: 1.44 KB
Versions: 2
Compression:
Stored size: 1.44 KB
Contents
module HeadMusic::Style::Annotations end # Ok, so a rule might be that after the first leap (after previous steps) # one should normally move by step in the opposite direction # unless another leap (in either direction) creates a consonant triad. # - Brian class HeadMusic::Style::Annotations::RecoverLargeLeaps < HeadMusic::Style::Annotation MESSAGE = "Recover large leaps by step in the opposite direction." def marks melodic_intervals.drop(1).to_a.map.with_index do |interval, i| previous_interval = melodic_intervals[i] if unrecovered_leap?(previous_interval, interval, melodic_intervals[i+2]) HeadMusic::Style::Mark.for_all((previous_interval.notes + interval.notes).uniq) end end.compact end private def unrecovered_leap?(first_interval, second_interval, third_interval) first_interval.large_leap? && !spelling_consonant_triad?(first_interval, second_interval, third_interval) && ( !direction_changed?(first_interval, second_interval) || !second_interval.step? ) end def spelling_consonant_triad?(first_interval, second_interval, third_interval) first_interval.spells_consonant_triad_with?(second_interval) || second_interval.spells_consonant_triad_with?(third_interval) end def direction_changed?(first_interval, second_interval) first_interval.ascending? && second_interval.descending? || first_interval.descending? && second_interval.ascending? end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
head_music-0.17.0 | lib/head_music/style/annotations/recover_large_leaps.rb |
head_music-0.16.2 | lib/head_music/style/annotations/recover_large_leaps.rb |