> On Tuesday 29 August 2006 10:47, Erik Sandberg replied: Thanks for responding, Erik
> On Monday 28 August 2006 13:55, Trevor Daniels wrote: > > I'm happily creating and using music functions but so far my attempts to > > define functions that can be used in \with or \context clauses > have failed. > > The suggested technique of making a void function using (make-music > > 'SequentialMusic 'void #t) doesn't seem to help. > > What do you want to achieve, more precisely? Being relatively new to lilypond I wanted to encapsulate useful expressions in variables and functions as I came across them. For music-related expressions I find these very useful, and I wanted to do the same for other types of sequences. Here's a simple example (thanks, Kieren) to reduce the size of a piano grand staff which I've failed to recast as a more general function for use in a \with clause: \new PianoStaff \with { fontSize = #-2 % reduce size of all fonts \override StaffSymbol #'staff-space = #(magstep -2) % reduce size of staves by same amount \override VerticalAlignment #'forced-distance = #11 % increase distance between staves for piano dynamics } ... rest of staves and music I wanted to define a void function something like staffSize=#( define-music-function (parser location fontsize separation) (number? number?) #{ fontSize = #$fontsize % change size of all fonts \override StaffSymbol #'staff-space = #(magstep #$fontsize) % change size of staves by same amount \override VerticalAlignment #'forced-distance = #$separation % change distance between staves for piano dynamics #} (make-music 'SequentialMusic 'void #t) ) which could be used as: \new PianoStaff \with { \staffSize #-2.0 #11.0 } but attempts to use a function within \with {...} cause an 'unexpected MUSIC_FUNCTION_SCM' error on \staffSize or leave the parser forlornly 'Parsing ...', depending on the contents of the function definition. Using a variable without parametrisation gives an 'unexpected MUSIC_IDENTIFIER' error. I don't know whether it is possible to do this, or whether I simply haven't learned how to do it properly yet. > Note that \with uses a different lexical mode than music, so e.g. the > \override keyword does not produce a music expression when used > inside \with. I had hoped (make-music 'SequentialMusic 'void #t) would prevent the parser looking for music. > > You can probably perform operations on the whole \with block if you are > clever, by applying a funciton on the \new expression, like > \myFun \new Staff=foo \with {bla bla} {music} > As a relative newbie I don't have the confidence to try this yet - maybe one day! > -- > Erik > Trevor > > _______________________________________________ lilypond-user mailing list lilypond-user@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-user