lilypond-devel
[Top][All Lists]
Advanced

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

trying to make a music function


From: Kieren MacMillan
Subject: trying to make a music function
Date: Thu, 1 Jun 2006 10:15:03 -0400

Hello, all!

I'm jumping in feet first, and would love a lifeguard to keep an eye on me... =)

As a first project, I'm trying to create a function to add a dynamic +text to a note event. From the docs, I realised that \displayMusic is my friend, so:

%% CODE BEGINS
\version "2.9.6"
ppSempre = #(make-dynamic-script (markup #:line(#:dynamic "pp" #:hspace -0.3 #:normal-text #:italic "sempre" )))
\relative c'
{
        \displayMusic c4\ppSempre
}
%% CODE ENDS

which gives

%% OUTPUT BEGINS
(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
              "pp"
              #:hspace
              -0.3
              #:normal-text
              (#:italic "sempre")))))))
%% OUTPUT ENDS

So then I copied [most of] the output and wrapped it thusly:

%% CODE BEGINS
\version "2.9.6"

dwt =
#(define-music-function (parser location dyn text event-chord) (string? string? ly:music?)
                        (let ((result-event-chord (ly:music-deep-copy 
event-chord)))
                                (set! (ly:music-property result-event-chord 
'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
              "pp"
              #:hspace
              -0.3
              #:normal-text
              (#:italic "sempre")))))))

                                result-event-chord))

\relative c'
{
        \dwt #'"f" #'"test" { c4 }
}
%% CODE ENDS

But I get

%% ERROR BEGINS
programming error: Spanner `DynamicLineSpanner' is not fully contained in parent spanner `VerticalAxisGroup'.
programming error: no broken bound
programming error: no broken bound
%% ERROR ENDS

and the output has only the note and duration (correctly) with no dynamic.

Any hints/corrections/suggestions would be appreciated.

Thanks,
Kieren.




reply via email to

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