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 2 of X


From: Kieren MacMillan
Subject: Re: trying to make a music function, Part 2 of X
Date: Thu, 1 Jun 2006 13:17:55 -0400

Hello, all --

Okay, I've got at least this much going:

%% CODE SNIPPET BEGINS
\version "2.9.6"

addDynText = #(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)
                                        (cons
(make-music 'AbsoluteDynamicEvent 'text (markup #:line (#:dynamic dyn #:normal-text (#:italic text))))
                                                (ly:music-property 
result-event-chord 'elements )))
                                result-event-chord ))


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

However...

1. I'd like the syntax to be easier -- maybe something like

    <c d e>8\addDynText #'( f . "(no, really)" )

or something even slicker, if anyone has a recommendation. Anyway, I don't know how to do that -- it would involve (car args) and so on, and I'm not there yet.

2. I don't know how to (or even where to look to find out how to) change the self-alignment-X or X-offset property of an 'AbsoluteDynamicEvent within the Scheme code. I tried to work it out by looking at the existing Lilypond (Scheme) code, to no avail (yet).

3. I'd love someone to tell me that I'm on the right track -- e.g., that I'm not bypassing the parser inadvertently, or creating some endless loop, or double-garbage-collecting, or "this would be better in C++", or whatever.

Hints, pointers, code samples, solutions, etc., would be greatly appreciated. =)

Thanks,
Kieren.




reply via email to

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