Sha256: 74c842cc6e432cf056ba14a216d4524bdad3f0c6acc82183e57781daec8b9d19
Contents?: true
Size: 1.09 KB
Versions: 1
Compression:
Stored size: 1.09 KB
Contents
module HeadMusic::Style::Annotations end class HeadMusic::Style::Annotations::AvoidCrossingVoices < HeadMusic::Style::Annotation MESSAGE = "Avoid crossing voices." def marks crossings end private def crossings crossings_of_lower_voices + crossings_of_higher_voices end def crossings_of_lower_voices [].tap do |marks| lower_voices.each do |lower_voice| lower_voice.notes.each do |lower_voice_note| notes_during = voice.notes_during(lower_voice_note) crossed_notes = notes_during.select { |note| note.pitch < lower_voice_note.pitch } marks << HeadMusic::Style::Mark.for_all(crossed_notes) end end end end def crossings_of_higher_voices [].tap do |marks| higher_voices.each do |higher_voice| higher_voice.notes.each do |higher_voice_note| notes_during = voice.notes_during(higher_voice_note) crossed_notes = notes_during.select { |note| note.pitch > lower_voice_note.pitch } marks << HeadMusic::Style::Mark.for_all(crossed_notes) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
head_music-0.13.2 | lib/head_music/style/annotations/avoid_crossing_voices.rb |