lilypond-user
[Top][All Lists]
Advanced

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

Confused about contexts and scope of macro


From: Thomas Ruedas
Subject: Confused about contexts and scope of macro
Date: Wed, 25 Apr 2012 01:23:10 +0200
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.5; rv:11.0) Gecko/20120327 Thunderbird/11.0.1

Hi,
I guess this is an easy one for more experienced users than me.
I am trying to port an older Lilypond file (v.2.8) to 2.14.2 and am having trouble with the scope of a macro whose purpose is to switch staffs in a PianoStaff that is part of a score for flute and piano. My original setup used to work and was taken more or less literally from example A.2.2 in http://lilypond.org/doc/v2.14/Documentation/learning/piano-templates (or rather its incarnation in the 2.8 docs).
The macros I have defined are:

u = { \change Staff = "right" \stemDown }
U = { \change Staff = "right" \stemUp }
l = { \change Staff = "left" \stemUp }

and the basic structure of my Lilypond file is given by the layout generated by Frescobaldi as reproduced at the bottom of this message (abridged but hopefully without loss of generality).
The error I get when compiling is the following:
Parsing...
Interpreting music...
[...]
l = {
     \change Staff = "left" \stemUp }
warning: cannot find context to switch to
u = {
     \change Staff = "right" \stemDown }
warning: cannot find context to switch to

etc. The resulting score is displayed, but the sections affected by the macro are pasted outside the actual score as loose snippets. Where do I have to put the macros, and how do I have to define them to make things work again?
Thanks,
Thomas

% input file skeleton
\version "2.14.2"
\header {
  title = "Sonatine für Querflöte und Klavier"
}
\paper {
  #(set-paper-size "a4")
}
% <--- here come those macros
scoreAGlobal = {
  \key c \major
  \numericTimeSignature
  \time 3/8
  \tempo "Moderato"
}

scoreAFlute = \relative c'' {
  \scoreAGlobal
  % Music follows here.
}

scoreARight = \relative c'' {
  \scoreAGlobal
  % Music follows here.
}

scoreALeft = \relative c' {
  \scoreAGlobal
  % Music follows here.
}

scoreAFlutePart = \new Staff \with {
  instrumentName = "Flöte"
  midiInstrument = "flute"
} \scoreAFlute

scoreAPianoPart = \new PianoStaff \with {
  instrumentName = "Klavier"
} <<
  \new Staff = "right" \with {
    midiInstrument = "acoustic grand"
  } \scoreARight
  \new Staff = "left" \with {
    midiInstrument = "acoustic grand"
  } { \clef bass \scoreALeft }
>>

\score {
  <<
    \scoreAFlutePart
    \scoreAPianoPart
  >>
  \header {
    piece = "II."
  }
  \layout { }
  \midi {
    \context {
      \Score
      tempoWholesPerMinute = #(ly:make-moment 150 8)
    }
  }
}
% and so on with B,C,D for three other movements
--



reply via email to

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