lilypond-user
[Top][All Lists]
Advanced

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

Control breaks in staff that I get from a variable?


From: Ole V. Villumsen
Subject: Control breaks in staff that I get from a variable?
Date: Sun, 11 Feb 2024 04:01:20 +0000

**Question in short**: Suppose I have a staff in a variable. Can I impose 
breaks (line breaks, page breaks, page turns) on that staff without modifying 
the variable? My use case is using the staff in a part and in a score with 
other parts, where obviously the breaks need to be different. Another use case 
could be using the staff on different page sizes.

**My research**: I am assuming for example

staffIGot = \new PianoStaff << %{ ... %] >>

As some of us know, this does not work:

<<
  \staffIGot
  { s1*5 \break }
>>

It introduces an extra staff. Not wanted.

I can trivially pick the staff apart and put parts ("voices" in Lilypond) into 
different variables that I can then combine with each other and with my desired 
breaks. It will be wordy and a bit error-prone (in particular with a piano 
staff with centred dynamics). You may say that my question is really a "luxury" 
one: can I avoid having to do this?

**My solution until now**: Here’s the best I have thought of: I put the staff 
in a separate source file (which I would want to do anyway), for example:

staffIGot = \new PianoStaff <<
  \new Staff <<
    \imposedBreaks
    % music goes here
  >>
  \new Staff { %{ more music here %} }
>>

As you can see, my staff now uses a variable \imposedBreaks that it does not 
define. So when I use the staff, I first define my desired breaks in there:

\version "2.24.3"

imposedBreaks = { s1*6 | \break }

\include "includeFileWithStaff.ly"

\new Score \staffIGot

This seems to give me my desired behaviour. I find it a bit tricky. A further 
downside is I also need to define imposedBreaks in scores where I don’t want to 
control breaks manually (I can define it empty).

**Question more precisely**: Is there a better, simpler, less tricky solution?

Sent with Proton Mail secure email.



reply via email to

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