lilypond-user
[Top][All Lists]
Advanced

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

Programmatically building music-function names


From: Chris Yate
Subject: Programmatically building music-function names
Date: Fri, 15 Jan 2016 17:06:11 +0000

Hi, 

I'm trying to typeset a number of short pieces into multiple scores in one file. I can do this manually, as:

```
musicOne = \relative c'' { g4 a b c }
musicTwo = \relative c'' { g4 a b c }

\score {  
 \musicOne
}

\score { 
  \musicTwo
}
```

However, there's a lot more common stuff in my real \score block, which means this approach gets very tedious. What I'm trying to do instead looks like:


```
printTheScore = 
#(define-music-function
     (parser location number )
     (string? )
#{     
\score {
 \music#number
}
#})

\printTheScore "One"
\printTheScore "Two"
```

This doesn't work; my substitution syntax is clearly wrong here, but I'd be interested to see if there's a way to do it.  Or does the way the code is parsed mean music functions can't be referenced in this way?

I've attached a ly file including the code I've pasted here.

thanks, 

Chris


Attachment: programmatic.ly
Description: Text Data


reply via email to

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