Deux \partCombine sur une même portée

La fonction \partCombine prend deux expressions musicales contenant chacune une partie et les distribue dans quatre contextes Voice nommés « two », « one », « solo » et « chords » selon le moment et la manière dont ces parties fusionnent en une voix commune. Les voix issues de \partCombine peuvent disposer de leurs propres propriétés de mise en forme définies de manière habituelle. Sont ici définies des extensions à \partCombine de sorte à faciliter le placement de quatre voix sur une seule portée.

La version originelle peut se saisir comme ici.

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'
  \partCombineUp \soprano \alto
  \partCombineDown \tenor \bass
>>

Et voici le code développé.

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"
  }
}
[image of music]

LilyPond snippets v2.25.32 (development-branch).