Carrick Patterson <[EMAIL PROTECTED]> writes:

> I have read and re-read this part of the manual for weeks, and experimented
> around and I cannot get it to work unless it also contains a music
> expression. All the examples have the padding variable or whatever it is
> defined using define-music-function, which requires also passing a music
> expression as a parameter. Example:

Why don't you post here what you have come up to, even if it's not
working, so that we could tell you what's wrong? Just asking from others
the solution to your problems without even showing that you looked for a
solution yourself is a bit easy.

> withPadding =
> #(define-music-function (parser location padding music) (number? ly:music?)
>
> I don't want to have to have a music expression when I call my function. I'd
> like to do something like:

If you don't want the music argument, start by removing the music argument.

myMark =
#(define-music-function (parser location padding) (number?)

> \myMark #3.0
>
> This would put a rehearsal mark in and pad it three units.

How do you write that in LilyPond notation? Something like:

 {
   \once \override Score.RehearsalMark #'padding = #3
   \mark
 }

Use #{ #} notation and put the parameter, padding, at the place of
the 3. Use '$' before parameter names in #{ #} notation: 

 #{
    \once \override Score.RehearsalMark #'padding = #$padding
    \mark \default
 #}

now you have a music function:

myMark =
#(define-music-function (parser location padding) (number?)
 #{
    \once \override Score.RehearsalMark #'padding = #$padding
    \mark \default
 #})


> It would be used like:
>
> \score{ \relative c
> { c d e f g a b c \myMark #3.0 c b a g f e d c}
> }

Please format ly snippets correctly:

\score {
  \relative c {
    c d e f g a b c \myMark #3.0 c b a g f e d c
  }
}

nicolas


_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to