lilypond-devel
[Top][All Lists]
Advanced

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

Re: trying to make a music function, Part 3 of X


From: Kieren MacMillan
Subject: Re: trying to make a music function, Part 3 of X
Date: Thu, 1 Jun 2006 16:37:04 -0400

Hi, Nicolas:

Thanks for the help!

You should indent your code properly, so that it should be less painful to read.

Believe it or not, I do -- it may be the email transfer that messes up some things...

Use \displayMusic !

Okay, I have. What I want to get is

%% OUTPUT BEGINS
(make-music
  'SequentialMusic
  'elements
  (list (make-music
          'ContextSpeccedMusic
          'property-operations
          '()
          'context-type
          'Bottom
          'element
          (make-music
            'OverrideProperty
            'once
            #t
            'grob-property-path
            (list (quote X-offset))
            'grob-value
            -1.5
            'symbol
            'DynamicText
            'pop-first
            #t))
        (make-music
          'EventChord
          'elements
          (list (make-music
                  'NoteEvent
                  'duration
                  (ly:make-duration 2 0 1 1)
                  'pitch
                  (ly:make-pitch -1 0 0))
                (make-music
                  'AbsoluteDynamicEvent
                  'text
                  (markup
                    #:line
                    (#:line
                     (#:dynamic
                      "f"
                      #:hspace
                      -0.3
                      #:normal-text
                      (#:italic "for a very long time")))))))))
%% OUTPUT ENDS

What I'm trying is
%% CODE BEGINS
\version "2.9.6"

addDynText =
#(define-music-function (parser location dyn text event-chord)
                        (string? string? ly:music?)
   (set! (ly:music-property event-chord 'elements)
         (cons (make-music 'AbsoluteDynamicEvent
                                        'text (markup #:dynamic dyn 
#:normal-text #:italic text))
               (ly:music-property event-chord 'elements)))

;(cons

        event-chord

; (make-music 'ContextSpeccedMusic 'property-operations '() 'context- type 'Bottom 'element (make-music 'OverrideProperty 'once #t 'grob- property-path (list (quote X-offset)) 'grob-value -1.5 'symbol 'DynamicText 'pop-first #t))

)

\relative c'
{
        \displayMusic
        {
                \addDynText "pp" "sempre" <c d e>4 c
                \addDynText "f" "(no, really)" <c d e>8 c c4
        }
}
%% CODE ENDS

Here I have commented out the offending lines -- I've tried a bunch of different things, like

    (make-music 'SequentialMusic 'elements (list...

but this just creates a nested SM, and throws an error.

Hopefully, if you can show me how to combine these two elements -- i.e., the EventChord and the ContextSpeccedMusic -- in this case, I'll have a bit of a general epiphany on the way the whole thing works.

Right now, the light bulb is definitely off!  =\

Thanks,
Kieren.




reply via email to

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