lilypond-user
[Top][All Lists]
Advanced

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

Re: Organising files/variables/ in lilypond


From: Eef Weenink
Subject: Re: Organising files/variables/ in lilypond
Date: Sat, 8 Apr 2023 17:52:24 +0000

Dear Valentin, 

I have been playing with the libary PartManager.ly
And was able to change some things, I understand a bit (not much) more about how it could work. 
I hope it was enough to make my question more clear/understandable. 
For example I have this file:
%----------------
\version "2.24.1"

global = {
 \key c \major
 \time 4/4
}

naam = "song 1"
flute = \relative c'' {
 \global
 c4 d e f
 % Muziek volgt hier.
}

\score {
 \header { piece =  \markup {\naam}}
 \new Staff
 \flute
 \layout { }
}


naam = "song 2"
flute = \relative c'' {
 \global
 d8 e f g
 % Muziek volgt hier.
}

\score {
 \header { piece =  \markup {\naam}}
 \new Staff
 \flute
 \layout { }
}
%--------

I have two songs. So I just copy past the first half and then change name, notes, what is needed. 
And as you see, I just re-use the same variable \flute. How simple can it be :-) 
It would be nice if I could seperate this, so I can just  call it (example: doscorewithsong. 
\score {
 \header { piece =  \markup {\naam}}
 \new Staff
 \flute
 \layout { }
}

The actual file is more complicated, but that is what I try to achieve. 
Using your partmanager.ly the variable is just overwritten, so I only see the last input
Hope my question is a bit more clear this way, 

Regards, Eef 




Op 7 apr. 2023, om 23:34 heeft Valentin Petzel <valentin@petzel.at> het volgende geschreven:

Hello Eef,

if I understand you correctly you essentially want to put the content of a
Lilypond file into a variable and evaluate that. This is not possible with
Lilypond as such, but instead you can avoid Lilypond syntax and directly use
the scheme hooks.

Instead of doing

all = ...

you can have a scheme function do

(set! all ...)

(but for this to work you need to have the binding "all" existing before by
doing #(define all #f) (or any other value).

Instead of simply creating a \score ... and let the parser delegate this to
the correct hook you can pass scores directly via scheme by doing

(add-score #{ \score { ... } #})

Generally there are many ways to do things, and we’d need to know more about
your specific situation to be able to elaborate a good solution.

Recently I did a mass for which I created a small framework which allows me to
first register parts and such by doing

\registerPart partname
\partSetTitle partname "Title"

\partSetStaff partname staffname { music }
...

and then when needed do

\partPrint name layoutfunction

to create a specific score or

\printParts layoutfunction

to print all scores.

layoutfunction is then a function taking partname and creating the desired
score.

I’d then have a folder "layouts" specifying layout functions, a folder
"styles" specifying stylesheets, and a folder of files registering scores, and
one or multiple masters reading these files and printing scores with one or
multiple layout functions.

I’ve included the core library and an example layout function. Maybe this
approach could be useful for you (I’ve also sent this to the list not too long
ago).

Cheers,
Valentin

Am Freitag, 7. April 2023, 16:11:43 CEST schrieb Eef Weenink:
I have this project: I make arrangements of figured bass pieces.
(Generalbass Wolf). In total 100 pieces. Uptill now I organised it this
way:
- 1 file with all pieces in it (I did about 10, 90 to go).
The file starts with an include of a startup.ily, with some settings for the
whole book then the first piece.
I include a file (arrangeit.ily) to change the music into several voices,
etcetera using arranger.ly<http://arranger.ly>. I add some lines to change
1-2 voices a bit using also arranger.ly<http://arranger.ly> then I include
a file (Generalbassmakescore.ily with the settings to create the score.
Second piece (with the same variablenames!)
and repeat the includes like mentioned above.
etcetera.

It works, looks well. At the end I have 1 file with alle the pieces and 3-4
files to do small jobs, It is not fast.

But somehow I have the idea this could be easier/better. But how?
- One idea would be to put all pieces in separate files and include this in
one file with all jobs: arranging, extra changes, create voice/score. But
then I will have 101 files

Most easy would be to create a file with procedures I need, include the file
and call the procedures when needed. . But how? Lilypond does not have
procedures (as far I know?). Using functions gives lots of errors.
I tried it with variables, but no luck either.

I try to put these lines in a variable/function/procedures (as an example):
What to do, to make lilypond use the lines between {} simply as a
replacement of the variable?

arrangeit = {
%----- verwerking-------
all = #'(pright pleft  soprano alto tenor bass viola contrabas soprano)
#(init all)

#(begin
  ;;pianopartij
 (rm 'pright '(1-4)   (rel 1 'melody) )
 (rm 'pleft '(1-4)   (rel  'bassline) )

;; koorpartijen
;; sopraan
 (rm 'soprano '(1-4) (note 1 (rel   'melody) ))
;;alt
 (rm 'alto '(1-4)   (note 2  (rel  1 'melody)) )
;; tenor
 (rm 'tenor '(1-4) (note 3 (rel 1 'melody) ))
;; bass
 (rm 'bass '(1-4)  (rel  'bassline) )
;;ciontrabass
 (rm 'contrabas ' (1-4)  (rel  'bassline) )
)
}

Eef

<full-score.ily><partManager.ily>


reply via email to

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