If you use the \partCombineChords command in one of the voices (as in the snippet I sent with last mail) it should override the default behavior of partCombine and work without tricks or problems. Did you try it?
> 1 juli 2021 kl. 17:44 skrev Dinh Hoang Tu <dhoan...@gmail.com>: > > Hello Leo, > > Thanks for your explanation. Got your point, totally agree it should not > combine when 2 voices are identical, otherwise it's confusing: cannot > distinguish 2 voices. > But when I use different font-sizes to distinguish 2 voices, I can only > combine them when 2 voices are on same side of one another. > If 2nd voice goes both upper and lower than 1st one, I cannot combine them. > > I found a trick, not nice, but at least works for this case: skip exceptional > note of 2nd voice, and render it on 1st voice with tweak > (I know this won't work if baritone has a separate lyrics, and here midi is > not correct either. Fortunately these are not my case ^^) > > \version "2.22.1" > localFontSize = > #(define-music-function (font-size music) (number? ly:music?) > (for-some-music > (lambda (m) > (if (music-is-of-type? m 'rhythmic-event) > (begin > (set! (ly:music-property m 'tweaks) > (cons `(font-size . ,font-size) > (ly:music-property m 'tweaks))) > #t) > #f)) > music) > music) > > soprano = { f'4 g'4 a'4 b'4 c''2 } > basso = { d'4 e' f'' g' a'2 } > alto = { d'4 e' \stemUp f'' g' a'2 } > tenor = { d'4 e' f'' g' a'2 } > \new Score { \new Staff << \partCombine \soprano \basso >> } % correct but > not expected > \new Score { \new Staff << \partCombine \soprano \alto >> } % expected, > without tweak, can combine but cannot confusing > \new Score { \new Staff << \partCombine \soprano \localFontSize -3 \tenor >> > } % distinguish 2 voices, but not combined > > mezzo = { f'4 g'4 <a' \tweak font-size #-3 f''>4 b'4 c''2 } > baritone = { d'4 e' \skip 4 g' a'2 } > \new Score { \new Staff << \partCombine \mezzo \localFontSize -3 \baritone >> > } % trick > > Thanks to all. > Have a good day. > > Tu' > >> On Thu, 1 Jul 2021 at 16:07, Leo Correia de Verdier >> <leo.correia.de.verd...@gmail.com> wrote: >> As a more general tip: if you want all stems to be pointing up you can >> specify that on document or score level in a layout block, like >> >> %%%% >> \layout { >> \context { >> \Voice >> \override Stem.direction = #UP >> }} >> %%%% >> >> Or on a staff level in \with statements, like >> >> %%%% >> \new Staff >> \with { \stemUp } >> ### music goes here >> %%%% >> >> > 1 juli 2021 kl. 10:54 skrev Leo Correia de Verdier >> > <leo.correia.de.verd...@gmail.com>: >> > >> > This is the intended behavior of partCombine. In the usual use case, with >> > the same notehead size you still want to be able to follow each voice, so >> > partCombine doesn’t merge them into chords when they’re crossed. (This is >> > obscured in your first example because you are using \stemUp there, >> > otherwise you would see the stems indicating the voicing). >> > >> > Anyway you can easily override this behavior by using partCombineChords, >> > like >> > … >> > %%%% >> > basso = { \partCombineChords d'4 e' \stemUp f'' g' a'2 } >> > %%%% >> > … >> > HTH >> > /Leo >> > >> >> 1 juli 2021 kl. 06:52 skrev Dinh Hoang Tu <dhoan...@gmail.com>: >> >> >> >> Sorry for short description in my last email. >> >> I mean when 2nd voice has notes going upper and lower than 1st voice, >> >> \partCombine won't combine 2 notes. >> >> There is a gap between 2 stems, as in attached image. >> >> >> >> Many thanks, >> >> Tu' >> >> >> >> On Thu, 1 Jul 2021 at 09:35, Dinh Hoang Tu <dhoan...@gmail.com> wrote: >> >> Hello Jean and all, >> >> >> >> I would love to contribute if I can :) >> >> >> >> Using this in one music sheet, if 2nd voice has notes going upper and >> >> lower than 1st voice, \partCombine will not work. >> >> >> >> \version "2.22.1" >> >> localFontSize = >> >> #(define-music-function (font-size music) (number? ly:music?) >> >> (for-some-music >> >> (lambda (m) >> >> (if (music-is-of-type? m 'rhythmic-event) >> >> (begin >> >> (set! (ly:music-property m 'tweaks) >> >> (cons `(font-size . ,font-size) >> >> (ly:music-property m 'tweaks))) >> >> #t) >> >> #f)) >> >> music) >> >> music) >> >> soprano = { f'4 g'4 a'4 b'4 c''2 } >> >> alto = { d'4 e' \stemUp f'' g' a'2 } >> >> basso = { d'4 e' \stemUp f'' g' a'2 } >> >> tenor = { d'4 e' \stemUp \tweak font-size #-3 f'' g' a'2 } >> >> \new Score { \new Staff << \partCombine \soprano \alto >> } >> >> \new Score { \new Staff << \partCombine \soprano \localFontSize -3 \basso >> >> >> } >> >> \new Score { \new Staff << \partCombine \soprano \tenor >> } >> >> >> >> Many thanks again to any help. >> >> >> >> Best, >> >> Tu' >> >> >> >> On Thu, 1 Jul 2021 at 04:00, Jean Abou Samra <j...@abou-samra.fr> wrote: >> >>> Le 30/06/2021 16:47, Dinh Hoang Tu <dhoan...@gmail.com> a écrit : >> >>> >> >>> >> >>> Hello Jean, Xavier, >> >>> >> >>> I think these music functions are useful enough to be integrated into >> >>> Lilypond itself. >> >>> I put them in my local music-functions-init.ly for personal use. >> >>> But it will be helpful for Lilypond users, including myself, to have >> >>> these handy features by default. >> >>> >> >>> Thank you and have a good day. >> >>> >> >>> Tu' >> >> >> >> Hello, >> >> >> >> Actually this particular music function is rather hacky. It only applies >> >> to notes and rests (not articulations or dynamics) and would fail with >> >> things like quoted music or events inserted via the edition engraver. In >> >> summary: it is not mature enough to be integrated in the core right away. >> >> >> >> As described in my previous email, one of the projects on my stack would >> >> make \override just work as expected, so I would prioritize working on >> >> this. >> >> >> >> Best regards, >> >> Jean >> > >> > <partcombine-tweak-trick.png>