lilypond-user
[Top][All Lists]
Advanced

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

Still confused about context vs. new


From: Patrick Horgan
Subject: Still confused about context vs. new
Date: Thu, 17 Jul 2008 13:35:03 -0700
User-agent: Thunderbird 2.0.0.14 (X11/20080505)

I see many examples with \context, or \new used in the same place. I've read LM 3.1.1 for example which tells me that if I don't create explicitly a \new Staff or \new Voice, they will be created automatically, and goes on to refer to that as the implicit creation of contexts. I often see examples that refer to contexts, via something like \context ChoirStaff, or \context Staff, that have not been explicitly created. Can I assume that they are implicitly created? Something like this recent example off the list:
\version "2.11"

\score {
  \context ChoirStaff <<
      \context Staff<<
\context Voice = voice \relative c'' { \voiceOne\repeat unfold 200 { e2 }
          \new Voice \relative c'' { \voiceTwo \repeat unfold 200 { c }}>>
      \context Lyrics \lyricsto "voice" { \repeat unfold 200 { la }  }
         \new Staff \relative c   <<
\new Voice { \clef "bass" \voiceOne \repeat unfold 200 { f } }
            \new Voice  { \voiceTwo  \repeat unfold 200 { a, } } >>  >>
\layout { }
}
Why does it use \context ChoirStaff instead of \new Choirstaff? Same for Staff? Same for Lyrics. If I change the \context to \new it works identically (I think). Does it? If not what's the difference? How do I know when to do which? If I replace all the \new with \context, the music changes. If I replace all the \context with \new it works fine. Why?

Is there a difference between:

\score {
   \new ChoirStaff <<
      \new Staff{
         \new Voice<<>>
      }
     \new Staff{
         \new Voice<<>>
   >>
}

and
\score {
   \new ChoirStaff <<
      \new Staff{
         \new Voice<<>>
      }
      \new Staff{
         \context Voice<<>>
      }
 >>
}

Are these referring to implicit always pre-existing contexts, so that changing the \context to \new just takes up more memory for nothing and the implicit ones are still there?

In LM 3.4.4 it implies without stating that changing a property of a Staff happens within the context of the current staff. i.e. setting instrumentName for a staff only affects that staff and goes on to say that if you don't specify Staff, then it will affect the default context, voice. I had to try it to see if \set Staff.instrumentName = #"Alto" would work--that was a nice clue, wish the text would have spelled that out. It seems as if the writers know this well, it's part of their /context/ <grin;> and they don't spell out things that now, to them are obvious.

Farther in LM 3.4.4. they begin using commands to change note heads without mentioning contexts at all. Am I to assume, that they affect a default context? Which is that? The last thing I read was to be careful because the default was Voice. So am I changing a Voice property here when I don't specify context?

I'm sure it's all clear if you already know it, but for me, it's quite fuzzy.

Patrick




reply via email to

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