PartCombine with rests

2018-06-07 Thread Kaj Persson
I am working on an SATB piece, and want to produce two things: 1) the 
note sheet and 2) a MIDI file as an aid for the singers in learning the 
music. I want two voices on one staff, so I tried using the partcombine 
facility.


At one point there is a long pause for the singers, where instruments 
play. Now I want to replace this long rest with a shorter one, so I 
looked for a suitable method. Tags looked promising, and I started with 
the first example in Notation Reference (chapter "1.5.2 Multiple voices" 
-> "Automatic part combining").As a measure three I want to insert 
something like


   if (midi) then R1; else \repeat unfold 2 { R1 }; fi

defined in some kind of meta language. Hence for the note sheet I want 
the long rest indicating where the orchestra is playing, but in the 
sound file (midi) this long pause is just irritating.


In the LilyPond language I cannot find such an "if - then - else" 
construction, but I thought I could use something with tags. So I tried


   \tag #'ySheet { R1 | R1 }       % note sheet, hence the long rest
   \tag #'yMidi { R1 }             % Midi, short rest

Well I put the rests in own variables to shorten the writings as you 
might see below.


I put the music in two separate \score sections with individual settings 
of the tag references ySheet resp. yMidi. Yes, it worked. I got one or 
two measures with rests.


But where are the chords from mark B and forward? They disappear when I 
add these rests. And why do the last whole notes not merge?


I have modified the original code a wee but not too much as far as I can 
find out.


I am sure this will have a solution if I start Scheme programming, but 
my knowledge in that language is not big enough (yet), and I was hoping 
there is a solution in pure LilyPond code.


As you can see I am using the latest officially stable version 2.18.2. 
Need I say that I have varied the code in a very big number of ways to 
find something working, but all in vain. Maybe the variable names 
instrumentOneA etc are misleading as they represent human voices and not 
the orchestra members, but I have chosen to keep the those in the 
example in the manual, just adding the letters A and B to indicate the 
position in the music.


I am sorry this message became rather long, but I could not make it 
shorter still describing the problem and my efforts so far.


Kaj

The code:


\version "2.18.2"

instrumentOneA = \relative c' {

\mark "A"

c4 d e f |

R1 |

}

instrumentOneB = \relative c' {

\mark "B"

d'4 c b a |

b4 g2 f4 |

e1 |

}

instrumentTwoA = \relative g' {

R1 |

g4 a b c |

}

instrumentTwoB = \relative g' {

b4 c b a |

g4 f( e) d |

e1 |

}

rSheet = { R1 | R1 | }

rMidi = { R1 | }

Music = {

<<

\new Staff

{

\new Voice { \instrumentOneA \tag ySheet { \rSheet } \tag yMidi { 
\rMidi } \instrumentOneB }


}

\new Staff { \instrumentTwoA \tag ySheet { \rSheet } \tag yMidi { 
\rMidi } \instrumentTwoB }


\new Staff

\partcombine {

\instrumentOneA \tag ySheet { \rSheet } \tag yMidi { \rMidi } 
\instrumentOneB


}

{

\instrumentTwoA \tag ySheet { \rSheet } \tag yMidi { \rMidi } 
\instrumentTwoB


}

>>

}

\score {

\keepWithTag ySheet {

\Music

}

\layout {}

}

\score {

\keepWithTag yMidi {

\Music

}

\layout {}

}



... and the result in appended file PartCombine_w_rests.pdf.




PartCombine_w_rests.pdf
Description: Adobe PDF document
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: [Spam] Partcombine with rests

2018-04-20 Thread Lukas-Fabian Moser

Rutger,

So: add \partcombineApart before bar 2 in either of your voices. You 
can revert in two ways:

(1) \undo \partcombineApart
(2) \partcombineAutomatic


Ah, stupid me! I only tried \once \partcombineApart which didn't work. 
(I don't understand much of Lilypond's internals so can't tell what can 
work and what can't beforehand.)


Thanks much for the hint!

Lukas

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: [Spam] Partcombine with rests

2018-04-20 Thread David Kastrup
Rutger Hofman  writes:

> On 20-04-18 08:46, Lukas-Fabian Moser wrote:
>> Folks,
>>
>> in the following example
>>
>> \version "2.19.80"
>>
>> One = \relative d'' {
>>    R1
>>    r8 d4 e8 f4
>> }
>>
>> Two = \relative g' {
>>    R1
>>    r4 e4 d2
>> }
>>
>> \new Staff \partcombine \One \Two
>
> As the docs state, the decision about which partcombiner mode to
> choose (Apart, Chords, SoloI, SoloII) is hard, and can frequently
> mismatch with the user's expectations. In that case, it is OK to
> specify the mode yourself.

That's a bit of a euphemism.  The main problem is that the part combiner
is really stupid with regard to dealing with note ends (basically it
doesn't): its operation is very much focused on note starts instead.  It
also does not have much of a notion of rests.

More often than not, it's not really a question of which rendering
should be chosen for best results but rather how to give the abysmally
stupid part combiner the right hints for doing a job it should have
"obviously" done by itself in the first place.

-- 
David Kastrup

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: [Spam] Partcombine with rests

2018-04-20 Thread Rutger Hofman

On 20-04-18 08:46, Lukas-Fabian Moser wrote:

Folks,

in the following example

\version "2.19.80"

One = \relative d'' {
   R1
   r8 d4 e8 f4
}

Two = \relative g' {
   R1
   r4 e4 d2
}

\new Staff \partcombine \One \Two


As the docs state, the decision about which partcombiner mode to choose 
(Apart, Chords, SoloI, SoloII) is hard, and can frequently mismatch with 
the user's expectations. In that case, it is OK to specify the mode 
yourself.


So: add \partcombineApart before bar 2 in either of your voices. You can 
revert in two ways:

(1) \undo \partcombineApart
(2) \partcombineAutomatic

HTH, Rutger

Lilypond treats the quarter note rest in the second voice as reason to 
put "Solo" and down-stem the first note of the first voice. I'm not sure 
this is reasonable behaviour since the lower voice has its own rest 
which \partCombine (reasonably) doesn't suppress, so in fact we have a 
two-voice situation for the whole bar.


I know how to get rid of the "Solo" marking, and of course I could also 
correct the stem of the upper voice's first note by \once\stemUp, 
\once\voiceOne or something similar (maybe combined with tags in order 
to still be able to create an extra part for the first voice). But 
somehow I feel that \partcombine shouldn't force me to do so.


So: Is there a way to make \partcombine recognize the lower voice's 
quarter rest as reason to automatically treat the upper voice as the 
\voiceOne ?


Best
Lukas




___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Partcombine with rests

2018-04-20 Thread Lukas-Fabian Moser

Folks,

in the following example

\version "2.19.80"

One = \relative d'' {
  R1
  r8 d4 e8 f4
}

Two = \relative g' {
  R1
  r4 e4 d2
}

\new Staff \partcombine \One \Two

Lilypond treats the quarter note rest in the second voice as reason to 
put "Solo" and down-stem the first note of the first voice. I'm not sure 
this is reasonable behaviour since the lower voice has its own rest 
which \partCombine (reasonably) doesn't suppress, so in fact we have a 
two-voice situation for the whole bar.


I know how to get rid of the "Solo" marking, and of course I could also 
correct the stem of the upper voice's first note by \once\stemUp, 
\once\voiceOne or something similar (maybe combined with tags in order 
to still be able to create an extra part for the first voice). But 
somehow I feel that \partcombine shouldn't force me to do so.


So: Is there a way to make \partcombine recognize the lower voice's 
quarter rest as reason to automatically treat the upper voice as the 
\voiceOne ?


Best
Lukas

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user