Module: HeadMusic::Style::Guideline::VoiceContext
- Included in:
- HeadMusic::Style::Guideline
- Defined in:
- lib/head_music/style/guideline/voice_context.rb
Overview
The company the voice keeps: the other parts of the composition, sorted and named the way a counterpoint rule asks after them.
Instance Method Summary collapse
-
#bass_voice? ⇒ Boolean
protected
-
#cantus_firmus ⇒ Object
protected
-
#higher_voices ⇒ Object
protected
-
#lower_voices ⇒ Object
protected
-
#other_voices ⇒ Object
protected
-
#unsorted_higher_voices ⇒ Object
protected
-
#unsorted_lower_voices ⇒ Object
protected
-
#voices ⇒ Object
protected
Instance Method Details
#bass_voice? ⇒ Boolean (protected)
29 30 31 |
# File 'lib/head_music/style/guideline/voice_context.rb', line 29 def bass_voice? lower_voices.empty? end |
#cantus_firmus ⇒ Object (protected)
17 18 19 |
# File 'lib/head_music/style/guideline/voice_context.rb', line 17 def cantus_firmus @cantus_firmus ||= other_voices.detect(&:cantus_firmus?) || other_voices.first end |
#higher_voices ⇒ Object (protected)
21 22 23 |
# File 'lib/head_music/style/guideline/voice_context.rb', line 21 def higher_voices @higher_voices ||= unsorted_higher_voices.sort_by(&:highest_pitch).reverse end |
#lower_voices ⇒ Object (protected)
25 26 27 |
# File 'lib/head_music/style/guideline/voice_context.rb', line 25 def lower_voices @lower_voices ||= unsorted_lower_voices.sort_by(&:lowest_pitch).reverse end |
#other_voices ⇒ Object (protected)
13 14 15 |
# File 'lib/head_music/style/guideline/voice_context.rb', line 13 def other_voices @other_voices ||= voices.reject { |part| part == voice } end |
#unsorted_higher_voices ⇒ Object (protected)
33 34 35 |
# File 'lib/head_music/style/guideline/voice_context.rb', line 33 def unsorted_higher_voices other_voices.select { |part| part.highest_pitch && highest_pitch && part.highest_pitch > highest_pitch } end |
#unsorted_lower_voices ⇒ Object (protected)
37 38 39 |
# File 'lib/head_music/style/guideline/voice_context.rb', line 37 def unsorted_lower_voices other_voices.select { |part| part.lowest_pitch && lowest_pitch && part.lowest_pitch < lowest_pitch } end |
#voices ⇒ Object (protected)
9 10 11 |
# File 'lib/head_music/style/guideline/voice_context.rb', line 9 def voices @voices ||= voice.composition.voices end |