lilypond-user
[Top][All Lists]
Advanced

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

Re: Header inside the score context


From: Valentin Petzel
Subject: Re: Header inside the score context
Date: Wed, 24 Nov 2021 18:07:25 +0000 (UTC)

Hello Paolo,

you've missunderstood what I meant. If you have each section in a separate file you can simly compile that file instead of uncommenting stuff. And you can have header and first section in the same file.

Cheers,
Valentin

24.11.2021 18:08:50 Paolo Prete <paolopr976@gmail.com>:

Hello Valentin,

thanks for your help!

I try to explain better what I need to do. Suppose that my score is divided into three sections. The first one has not only notes, but a title too. 
I need to render the sections all together or individually. The first obvious way to do that is write the score in the form:


%%%%%
\markup { "My-Title" }
{
% SECTION 1 (title + notes)
{ c'1 c' d' d'\pageBreak }

%SECTION 2
{ c'1 c' d' d'\sustainOn\pageBreak }

%SECTION 3
{ c'1 c'\sustainOff d' d' }

}
%%%%%

and then comment or comment out parts of the score that I don't need to render. So, for example, if I need to render only section 2, I would comment section 3 and section 1 but I have to comment the markup block separately as well: this is unwanted, because the markup belongs to section 1 context. Instead, it would be more appropriate to exclude automatically the markup block when section one is not included.
Note that putting the sections into separate files, as you suggested, does not solve the problem: instead of commenting blocks of code, I would have to exclude both the file associated to the markup and the file associated to section 1, if I want to render section 2.
Now, if I try to by-pass the problem with a \book context, I can embed the markup into section 1:

%%%%%
\book {

% SECTION 1 (title + notes)
\markup { "My-Title" }
{ c'1 c' d' d'\pageBreak }

%SECTION 2
{ c'1 c' d' d'\sustainOn\pageBreak }

%SECTION 3
{ c'1 c'\sustainOff d' d' }

}
%%%%%

In this way, I could embed the markup into section 1, but it won't work for another reason: the presence of the pedal needs that all the sections belong to the same context. Note too that if I tweak sections of a score into separate scores, I would have a logical mismatch between the syntax used for blocks of code and what that blocks of code effectively represent, which is unwanted too. 

Hope this is more clear. Unfortunately the problem is tricky (and I hope I'm wrong, so that there is already a right approach for it)

Best,

Paolo




On Wed, Nov 24, 2021 at 5:00 PM Valentin Petzel <valentin@petzel.at> wrote:
Hello Paolo,

I don’t really understand what you want to do. But if you only want render
parts of your project I advise against commenting out and commenting in stuff.
Instead (since you have a new section there anyway) put the different sections
into different scores (you can tweak the second score so that it does not in
fact look like it’s a new score) in different files. Then you could have a
file header.ly which contains the header, a file secI.ly which contains the
first section, secII.ly which contains the second section and so on. And then
you could simply do

\include "header.ly"
\include "secI.ly"
\include "secII.ly"

and so on. If you want to render one section you just need to render the
particular file.

If you don’t want separate scores you could do use files which define the
different parts in variables and stitch them together in the score.

Like if you have a duetto with flauto dolce and bass tuba for example
(marvellous combination!) you could have in
secI.ly:
FluteSecI = { music }
TubaSecI = { music }

And similar in secI.ly. Then in the score you can stitch them together like
Flute = { \FluteSecI \pageBreak \FluteSecI }
And similar.

Then to get an output in your separate file you can create a separate score,
only containing the section (which is something you could probably quickly do
using templates.

You can then assign this score to a variable like thisscore=\score{...} and
then do something like
#(if (not (defined? 'included)) (add-score thisscore))

Then you can do #(define included 0) (or whatever value) before you include
these files, and thus these scores will not be output if you compile the full
score, but if you compile the files themselves they are.

Cheers,
Valentin


Am Mittwoch, 24. November 2021, 13:01:11 CET schrieb Paolo Prete:
> Hello,
>
> Given a header like this:
>
> %%%%%%%%
> \markuplist {
>
> \fill-line {
>   \override #'(font-name . "Liberation Sans")
>   \override #'(font-size . 6)
>   "Author"
> }
>
> \vspace #4
>
> \fill-line {
>   \override #'(font-name . "Liberation Sans")
>   \override #'(font-size . 15)
>   "Title"
> }
>
> \vspace #2
>
> \fill-line {
>   \override #'(font-name . "Liberation Sans")
>   \override #'(font-size . 10)
>   "Subtitle"
> }
>
> \vspace #6
>
> }
>
> {
>
> %section 1
> c'1 c' c' \break c' c'
>
> \pageBreak
>
> %section 2
> e'1 e' f' \break f' f'
>
> }
>
> %%%%%
>
> ... I would like to put it inside the score context. Is it possible ?
> In this way, given that the above header is only bound to the first page of
> the score, if I want to render only page 2 I would not need two block
> comments  (page 1 and header), but I would use only one block comment.
>
> (Maybe by using the following hacky way to have multiple marks on the same
> bar:
> https://lilypond.org/doc/v2.23/Documentation/snippets/expressive-marks
> (Creating simultaneous rehearsal marks) ?)
>
> Thanks!
>
> P

reply via email to

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