[Top][All Lists]

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

Using addlyrics with a variable

From: Neil Killeen
Subject: Using addlyrics with a variable
Date: Mon, 10 Oct 2005 08:20:52 +0000


I am exploring lilypond for the first time. In evaluating its suitability for my
purposes, I am making a little test piece to explore layouts.

I am having trouble with lyric setting.  I would like to use a pre-defined
variable with the \addlyrics command (I can't find the answer in the manual
or archives).

Thus something along the lines of

sopLyric = {  One Two  Three }
{ a b c }
\addlyrics \sopLyric

However, this approach fails.  The actual error I get from my actual
test piece is error: syntax error, unexpected STRING
sopLyric = {
            One Two  Three }

OK, so I guess I have something wrong with the variable assignment syntax
(sopLyric = ...) and it is not allowed to put a string like this. I have tried other things; with quotes, and trying to put the addlyrics in the variable but I can't get this
approach to work.

As far as I can see, the manual does not have an example of this. Whenever it uses \addlyrics, the examples give the lyrics directly where the \addlyrics command is used. I can't find anything about using strings in the explanation of assigning
variables either.

The manual does show how to use a pre-defined variable with the more complex
lyric modes. So I tried this too. Below is the actual code (rather than some pseudo code like above) that I used. You can see I am trying to use lyricmode
and lyricsto on the Soprano voice (the only one for now).  The music is
enclosed between << and >> because of course I really want to have
several voices (sop,mez,alto) but in finding the simplest version of what
I am doing that fails, I have pulled the other voices out.

The error I get is

warning: cannot find Voice `sop'

(although I have defined it), and the resultant type-set file has two staffs; one empty, the second with
the actual soprano voice notes and no lyric.

As far as I can see I have followed the examples in the manual.

I note that if I remove the << and >> this error message does not occur,
but the same wrong output arises.

Perhaps I should be using some of the other commands like \score etc but
I don't really know what they are for at this point (they just start appearing
in the manual without explanation).

advice appreciated !


\include ""
\version "2.6.3"
\midi{ \tempo 4=72 }
\header {
 title = \markup { "Test Piece" }
 composer = \markup { "Mr. Wiggle" }
 poet = \markup { "Mr. Biggles" }
common = {
 \key g \major
 \time 3/4
sopNotes = {
  \relative c' {
     \set Staff.instrument = \markup {Soprano}
     \tempo 4=80
     \clef treble
     e'2 d4   c2 <b d>4   a8( b) c2
sopLyric = \lyricmode {
 One Two   One Two  One __ Two
 \context Voice = sop {
    \new Staff  {
  \lyricsto "sop" \new Lyrics \sopLyric

reply via email to

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