lilypond-user
[Top][All Lists]
Advanced

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

Using a variable with \relative


From: Basso Ridiculoso
Subject: Using a variable with \relative
Date: Fri, 9 Sep 2011 18:56:47 -0700

Is there a way to do something similar to this:

\include "english.ly"

x = { c }
y = { g }

\score {
<<
\new Staff {
    \clef "bass"
    
    \relative \x { d e f g a }
    
    \relative \y { bf a c d }

    }
>>       
    }


Perhaps I need to write a function that sends in a variable?

How does one dereference a variable inside of a function?

For instance if I sent in \x how do I say "use the value of x"? Or is that necessary?

This doesn't seem to work either - 

MyTestFunction =
#(define-music-function
     (parser location firstnote secondnote thirdnote fourthnote fifthnote sixthnote )
     ( ly:music? ly:music? ly:music? ly:music? ly:music?  ly:music? )
   #{    
                \relative $firstnote { $firstnote    $secondnote     $thirdnote  }
                \relative $sixthnote { $fourthnote  $fifthnote $sixthnote }
   #})


Any help would be appreciated, I have looked at some other functions, but haven't seen anything similar.

Thanks,
Daniel



reply via email to

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