I have a few transcription to do, using lilypond. It consists of a few songs, all of the same composer/poet, but there might be more to come. I already have a few helper functions in a that I include in each score, but I'd like to have a function to automate header creation, something I could call like this:
\mkheader "my song"
or something similar.
This would avoid the need to write
\header {
composer = "the composer of all the songs"
title = "my song"
}
in each song.
Since two days ago, I've been (re-)reading the lilypond documentation, but I can't get it to work. Any ideas?
You are likely needing Include files.
Directory structure:
.
├── my_include.ly
├── my_main.ly
my_include.ly
\header {
composer = "the composer of all the songs"
title = "my song"
}
my_main.ly
\version "2.20.0"
\include "my_include.ly"
melody = \relative c {
\key c \major
\time 4/4
c c c c |
}
\score {
<<
\new Staff { \melody }
>>
}
It might be that you want to add extra information later in your main lilypond file, in which case you just add another header block my_main.ly
\version "2.20.0"
\include "./my_include.ly"
\header {
subtitle = "my_subtitle"
subsubtitle = "my_subsubtitle"
}
melody = \relative c'' {
\key c \major
\time 4/4
c c c c |
}
\score {
<<
\new Staff { \melody }
>>
}