lilypond-user
[Top][All Lists]
Advanced

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

scheme music function going backwards in time (or "better mp dolce")


From: Graham Percival
Subject: scheme music function going backwards in time (or "better mp dolce")
Date: Tue, 30 Sep 2008 23:43:28 -0700

Four years ago, it was impossible to write a music function that
affected the music event it was attached to.  (if I understand
this post correctly):
http://lists.gnu.org/archive/html/lilypond-devel/2004-08/msg00019.html

Is this possible now?  I'm running into this problem.

I have a scheme function for nicely-spaced dynamic+text marks (ie
mp dolce), but it adds the dynamic to the note *after* it appears
in the score -- to add "f legato" to the E, I need to write
  c \flegato e d c
instead of
  c e\flegato d c

Can anybody see a nice solution to this?  Omiting the initial
(make-music 'SequentialMusic) puts the dynamic on the right note,
but the OverrideProperty stops working.  Writing the dynamic in
front of the note produces good output, but it breaks the lilypond
postfix-ish notation.

Cheers,
- Graham

#(define (make-dynamic-extra dynamic string)
  (make-music
  'SequentialMusic
  'elements
    (list
     (make-music
       'OverrideProperty
       'pop-first #t
       'grob-property-path (list (quote X-offset))
       'once #t
       'grob-value -1
       'symbol 'DynamicText)
     (make-dynamic-script (markup
       #:box #:line(
                    dynamic
                    #:text string)))
     )))
flegato  = #(make-dynamic-extra "f"  "legato")

\relative c' {
  % adds dynamic to the D -- wrong
  c e\flegato d c
  % adds dynamic to the E -- good output, but code looks bad
  c \flegato e d c
}




reply via email to

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