Two \partCombine pairs on one staff: Difference between revisions
Appearance
m New category |
Revise |
||
| (2 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
The <code>\partCombine</code> function takes two music expressions each containing a part, and distributes them among four <code>Voice</code> | The <code>\partCombine</code> function takes two music expressions, each containing a part, and distributes them among four <code>Voice</code> contexts named “one”, “two”, “solo”, and “shared”, depending on when and how the parts are merged into a common voice. | ||
Variants of <code>\partCombine</code> are <code>\partCombineUp</code> and <code>\partCombineDown</code> to produce up-stem and down-stem merging of two voices, respectively. Combining them to squeeze four parts into a single staff, however, need some special setup, which this snippet defines accordingly. | |||
< | <lilypond version="2.24"> | ||
customPartCombineUp = | |||
#(define-music-function (part1 part2) (ly:music? ly:music?) | |||
"Make an up-stem `VoiceBox` context that combines PART1 and PART2. | |||
The context is called 'Up'; internally, the function calls | |||
`\\partCombineUp`." | |||
#{ | |||
\new VoiceBox = "Up" << | |||
\context Voice = "one" { \voiceOne } | |||
\context Voice = "two" { \voiceThree } | |||
\context Voice = "shared" { \voiceOne } | |||
\context Voice = "solo" { \voiceOne } | |||
\context NullVoice = "null" {} | |||
\partCombine #part1 #part2 | |||
>> | |||
#}) | |||
customPartCombineDown = | |||
#(define-music-function (part3 part4) (ly:music? ly:music?) | |||
"Make a down-stem `VoiceBox` context that combines PART3 and PART4. | |||
The context is called 'Down'; internally, the function calls | |||
`\\partCombineDown`." | |||
#{ | |||
\new VoiceBox = "Down" << | |||
\set VoiceBox.soloText = #"Solo III" | |||
\set VoiceBox.soloIIText = #"Solo IV" | |||
\context Voice ="one" { \voiceFour } | |||
\context Voice ="two" { \voiceTwo } | |||
\context Voice ="shared" { \voiceFour } | |||
\context Voice ="solo" { \voiceFour } | |||
\context NullVoice = "null" {} | |||
\partCombine #part3 #part4 | |||
>> | |||
#}) | |||
soprano = { d'4 | cis' b e' d'8 cis' | cis'2 b } | |||
alto = { fis4 | e8 fis gis ais b4 b | b ais fis2 } | alto = { fis4 | e8 fis gis ais b4 b | b ais fis2 } | ||
tenor = { a8 b | cis' dis' e'4 b8 cis' d'4 | gis cis' dis'2 } | tenor = { a8 b | cis' dis' e'4 b8 cis' d'4 | gis cis' dis'2 } | ||
| Line 9: | Line 46: | ||
\new Staff << | \new Staff << | ||
\key b\minor | \key b\minor | ||
\clef alto | \clef alto | ||
\partial 4 | \partial 4 | ||
\transpose b b' | \transpose b b' \customPartCombineUp \soprano \alto | ||
\customPartCombineDown \tenor \bass | |||
\ | >> | ||
> | |||
\layout { | \layout { | ||
\context { | \context { | ||
| Line 33: | Line 66: | ||
} | } | ||
} | } | ||
</lilypond> | </lilypond> | ||
[[Category:Scheme]] | |||
[[Category:Simultaneous notes]] | [[Category:Simultaneous notes]] | ||
[[Category:Staff notation]] | [[Category:Staff notation]] | ||
[[Category:Included in the official documentation]] | [[Category:Included in the official documentation]] | ||
[[Category:Snippet]] | [[Category:Snippet]] | ||
Latest revision as of 15:15, 28 December 2025
The \partCombine function takes two music expressions, each containing a part, and distributes them among four Voice contexts named “one”, “two”, “solo”, and “shared”, depending on when and how the parts are merged into a common voice.
Variants of \partCombine are \partCombineUp and \partCombineDown to produce up-stem and down-stem merging of two voices, respectively. Combining them to squeeze four parts into a single staff, however, need some special setup, which this snippet defines accordingly.
\version "2.24"
customPartCombineUp =
#(define-music-function (part1 part2) (ly:music? ly:music?)
"Make an up-stem `VoiceBox` context that combines PART1 and PART2.
The context is called 'Up'; internally, the function calls
`\\partCombineUp`."
#{
\new VoiceBox = "Up" <<
\context Voice = "one" { \voiceOne }
\context Voice = "two" { \voiceThree }
\context Voice = "shared" { \voiceOne }
\context Voice = "solo" { \voiceOne }
\context NullVoice = "null" {}
\partCombine #part1 #part2
>>
#})
customPartCombineDown =
#(define-music-function (part3 part4) (ly:music? ly:music?)
"Make a down-stem `VoiceBox` context that combines PART3 and PART4.
The context is called 'Down'; internally, the function calls
`\\partCombineDown`."
#{
\new VoiceBox = "Down" <<
\set VoiceBox.soloText = #"Solo III"
\set VoiceBox.soloIIText = #"Solo IV"
\context Voice ="one" { \voiceFour }
\context Voice ="two" { \voiceTwo }
\context Voice ="shared" { \voiceFour }
\context Voice ="solo" { \voiceFour }
\context NullVoice = "null" {}
\partCombine #part3 #part4
>>
#})
soprano = { d'4 | cis' b e' d'8 cis' | cis'2 b }
alto = { fis4 | e8 fis gis ais b4 b | b ais fis2 }
tenor = { a8 b | cis' dis' e'4 b8 cis' d'4 | gis cis' dis'2 }
bass = { fis8 gis | a4 gis g fis | eis fis b,2 }
\new Staff <<
\key b\minor
\clef alto
\partial 4
\transpose b b' \customPartCombineUp \soprano \alto
\customPartCombineDown \tenor \bass
>>
\layout {
\context {
\Staff
\accepts "VoiceBox"
}
\context {
\name "VoiceBox"
\type "Engraver_group"
\defaultchild "Voice"
\accepts "Voice"
\accepts "NullVoice"
}
}