bug-lilypond
[Top][All Lists]
Advanced

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

Fwd: Macro pre-processing?


From: David Feuer
Subject: Fwd: Macro pre-processing?
Date: Sun, 9 Apr 2006 13:50:44 -0400

I think the following messages to lilypond-users (as well as my own
complete inability to understand music functions) suggest that the
manual could use some work in this area.

David Feuer

---------- Forwarded message ----------
From: Nicolas Sceaux <address@hidden>
Date: Apr 8, 2006 2:56 PM
Subject: Re: Macro pre-processing?
To: Carrick Patterson <address@hidden>
Cc: Lilypond mailing list <address@hidden>, Mats Bengtsson
<address@hidden>


Carrick Patterson <address@hidden> 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
address@hidden
http://lists.gnu.org/mailman/listinfo/lilypond-user




---------- Forwarded message ----------
From: Nicolas Sceaux <address@hidden>
Date: Apr 8, 2006 3:10 PM
Subject: Re: define-music-function help
To: Allan Spagnol Comar <address@hidden>
Cc: address@hidden


"Allan Spagnol Comar" <address@hidden> writes:

> Hi list, I am trying to generate a music-function to make
> ^\markup { \musicglyph #"timesig.C44" \vcenter "1" }
> for me any time, and the function should receive a string to be placed
> where "1" is writed. Is this possible ? if it is how can I do it ? or
> where can I find documentation about it ?

Music functions are used to build music expression.
Here you want to build a markup expression: define a markup command.

#(define-markup-command (myCommand layout props arg) (string?)
  (interpret-markup layout props (markup #:musicglyph "timesig.C44"
#:vcenter arg)))

{
  c'-\markup \myCommand #"foo"
}

nicolas



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




reply via email to

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