Variable Variablennamen II

Zur Navigation springen Zur Suche springen

In der Datei wird ein Text definiert, der als Teil eines Variablennamens interpretiert wird.

Mittels eines Scheme-Programms kann man die Namen der definierten Variablen in das Logfile ausgeben.

Lilypond-Code

\version "2.20.0"
\language "deutsch"

myTitel="Die lustigen Hammerschmiedgselln"

mus = \relative c'' { c4 c8 c }

%% Variablen für 1. und 2. Stimmen
#(ly:parser-include-string (string-append "\"m" myTitel "1\"")) = \mus

#(ly:parser-include-string (string-append "\"m" myTitel "2\"")) = \transpose c c, \mus

%% Variable für Akkordbezeichnungen
#(ly:parser-include-string (string-append "\"c" myTitel "\"")) =
\chordmode { \mus }

%% Texte für Strophen 1+2
#(ly:parser-include-string (string-append "\"l" myTitel "1\"")) = \lyricmode {
  \set stanza = #"1."
  Stro -- phe I
}

#(ly:parser-include-string (string-append "\"l" myTitel "2\"")) = \lyricmode {
  \set stanza = #"2."
  Stro -- phe II
}

\paper {
  print-all-headers = ##t
}

\score
{
  <<
    \new Staff="leadsheet" \with {
    }
    <<
      \tocItem \markup #myTitel
      <<
        \context Voice="melody" {
          \voiceOne
          #(ly:parser-include-string (string-append "\\\"m" myTitel "1\""))
        }
        \context Voice="sndvoice"

        { \voiceTwo #(ly:parser-include-string (string-append "\\\"m" myTitel "2\"")) }
      >>
      \new Lyrics \lyricsto "melody" {
        #(ly:parser-include-string (string-append "\\\"l" myTitel "1\""))
      }
      \new Lyrics \lyricsto "melody" {
        #(ly:parser-include-string (string-append "\\\"l" myTitel "2\""))
      }
    >>
    \context ChordNames
    { #(ly:parser-include-string (string-append "\\\"c" myTitel "\"")) }
  >>
  \header {
    title = #myTitel
    poet = ""
    composer = \markup {
      \override #'(baseline-skip . 1)
      \right-column {
        "Text: Volkslied"
        "Melodie: Volksweise"
      }
    }
    piece = ##f
    opus = ##f
  }
}

%% ... und dann noch der Liedtext als Markup

\version "2.20.0"
\language "deutsch"

myTitel="Die lustigen Hammerschmiedgselln"

mus = \relative c'' { c4 c8 c }

%% Variablen für 1. und 2. Stimmen
#(ly:parser-include-string (string-append "\"m" myTitel "1\"")) = \mus

#(ly:parser-include-string (string-append "\"m" myTitel "2\"")) = \transpose c c, \mus

%% Variable für Akkordbezeichnungen
#(ly:parser-include-string (string-append "\"c" myTitel "\"")) =
\chordmode { \mus }

%% Texte für Strophen 1+2
#(ly:parser-include-string (string-append "\"l" myTitel "1\"")) = \lyricmode {
  \set stanza = #"1."
  Stro -- phe I
}

#(ly:parser-include-string (string-append "\"l" myTitel "2\"")) = \lyricmode {
  \set stanza = #"2."
  Stro -- phe II
}

\paper {
  print-all-headers = ##t
}

\score
{
  <<
    \new Staff="leadsheet" \with {
    }
    <<
      \tocItem \markup #myTitel
      <<
        \context Voice="melody" {
          \voiceOne
          #(ly:parser-include-string (string-append "\\\"m" myTitel "1\""))
        }
        \context Voice="sndvoice"

        { \voiceTwo #(ly:parser-include-string (string-append "\\\"m" myTitel "2\"")) }
      >>
      \new Lyrics \lyricsto "melody" {
        #(ly:parser-include-string (string-append "\\\"l" myTitel "1\""))
      }
      \new Lyrics \lyricsto "melody" {
        #(ly:parser-include-string (string-append "\\\"l" myTitel "2\""))
      }
    >>
    \context ChordNames
    { #(ly:parser-include-string (string-append "\\\"c" myTitel "\"")) }
  >>
  \header {
    title = #myTitel
    poet = ""
    composer = \markup {
      \override #'(baseline-skip . 1)
      \right-column {
        "Text: Volkslied"
        "Melodie: Volksweise"
      }
    }
    piece = ##f
    opus = ##f
  }
}

%% ... und dann noch der Liedtext als Markup

Graphische Ausgabe

Ausgabe im Logfile

(#{cDie\ lustigen\ Hammerschmiedgselln}#
  #{lDie\ lustigen\ Hammerschmiedgselln1}#
  #{lDie\ lustigen\ Hammerschmiedgselln2}#
  #{mDie\ lustigen\ Hammerschmiedgselln1}#
  #{mDie\ lustigen\ Hammerschmiedgselln2}#
  mus
  myTitel)
($defaultpaper toplevel-scores)

Links