lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

PartCombine with rests


From: Kaj Persson
Subject: PartCombine with rests
Date: Thu, 7 Jun 2018 19:32:17 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0

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.


   

Attachment: PartCombine_w_rests.pdf
Description: Adobe PDF document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]