The problem is that the commands \clef and \key are only recognized correctly if you are in \notes{...} input mode. So, either move your settings of \clef and \key into your definitions of upper and lower or add a \notes when you declare your Staff contexts: \context Staff = upper \notes{ \clef violin \key f \major \time 2/4 \upper } \context Staff = lower {\clef bass \key f \major \lower }
I find your use of << and >> quite confusing. First of all, you could just as well use {...} as long as you don't have several simultaneous voices in the stave. Also, you have declared the Staff "lower" as a part of the Staff "upper", since the >> that matches \context Staff = upper << is inserted below your declaration of the lower stave. My example above should solve also these problems.
Finally, many people use an extra variable for common declarations that should be included in several staves. For example, you could do: global = \notes{\key f \major \time 2/4 } and use it with \context Staff = lower \notes{\clef bass \global \lower }
/Mats
Die5Willes wrote:
Hi there! I want to type piano music and for that I'm using the simple-piano-music-template from the lilypond homepage. It's the first time I'm trying to use variables to enter notes in a score, and now there is the following difficulty: everything looks fine as long as there is no specification of the key but when I'm trying to set the key to f-major, there is an error message. So here is an extract from my score made by lily 2.2.5 on a windows-machine and after that there is the error message: so, please tell me: where is the mistake or what can I do to produce the f-major key??
upper = \notes \relative c' { \partial 8*1 g'8 | c32[ b c d e8] e32[ d e f g8] }
lower = \notes \relative c { \partial 8 *1 r8 | <c e>8 r <c e>8 r }
\score {
\context PianoStaff << \set PianoStaff.instrument = "Piano " \context Staff = upper << \clef violin \key f \major \time 2/4 \upper
\context Staff = lower << \clef bass \key f \major \lower
>> >>
and here is the error message:
piano.ly:25:49: error: syntax error, unexpected STRING, expecting DEFAULT or NOTENAME_PITCH:
\context Staff = upper << \clef violin \key f \major \time 2/4 \upper
piano.ly:25:56: error: Have to be in Lyric mode for lyrics: \context Staff = upper << \clef violin \key f \majo r \time 2/4 \upper
piano.ly:26:50: error: syntax error, unexpected STRING, expecting DEFAULT or NOTENAME_PITCH:
\context Staff = lower << \clef bass \key f \major \lower
piano.ly:26:57: error: Have to be in Lyric mode for lyrics:
\context Staff = lower << \clef bass \key f \majo
r \lower
Interpreting music... piano.ly:25:49: warning: Junking event: `LyricEvent':
\context Staff = upper << \clef violin \key f \major \time 2/4 \upper
piano.ly:26:50: warning: Junking event: `LyricEvent':
\context Staff = lower << \clef bass \key f \major \lower
Thank you very much for helping! Stefan
_______________________________________________ lilypond-user mailing list [EMAIL PROTECTED] http://lists.gnu.org/mailman/listinfo/lilypond-user
-- ============================================= Mats Bengtsson Signal Processing Signals, Sensors and Systems Royal Institute of Technology SE-100 44 STOCKHOLM Sweden Phone: (+46) 8 790 8463 Fax: (+46) 8 790 7260 Email: [EMAIL PROTECTED] WWW: http://www.s3.kth.se/~mabe =============================================
_______________________________________________ lilypond-user mailing list [EMAIL PROTECTED] http://lists.gnu.org/mailman/listinfo/lilypond-user