lilypond-user
[Top][All Lists]
Advanced

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

How to define some context statements


From: Werner Arnhold
Subject: How to define some context statements
Date: Fri, 18 Jan 2019 11:00:32 +0100

Dear list,

I often need to have Midi output with different volume or instruments in
some voices. Here an example:

\version "2.18.2"

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

soprannoten = \relative c'' {
  g e e2 f4 d d2
}

altnoten = \relative c'' {
  c2 g g2 b4 f
}

\score {
  \new ChoirStaff <<
    \new Staff <<
      \set Staff.instrumentName = #"Sopran"
      \new Voice = "sopran" <<
        \set midiInstrument = #"flute"
        \global
        \soprannoten
      >>
    >>
    \new Staff <<
      \set Staff.instrumentName = #"Alt"
      \new Voice = "alt" <<
        \set midiInstrument = #"violin"
        \global
        \altnoten
      >>
    >>
  >>
  \layout{}
  \midi{
    \tempo 4 = 80
      \context {
        \Staff
        \remove "Staff_performer"
      }
      \context {
        \Voice
        \consists "Staff_performer"
      }
  }
}

This works fine. Now I tried to separate the "\context" parts in the
midi section like

verschiedene_stimmen = {
  \context \Staff \remove "Staff_performer"
  \context \Voice \consists "Staff_performer"
}

score {
.
.
.
  \midi{
    \verschiedene_stimmen
  }
}

Lilypond complains about unvalid escape sequence "\Staff" at the Place
of the definition, unexpected "\remove" and so on. That happens even if
I do not call the defined macro in the midi section.

What will be the reason and how can I make it better. I intend to
collect such often used constructs in a separate file.

Thanks in advance!

Werner




reply via email to

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