[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
define-music-function question
From: |
Ian Hulin |
Subject: |
define-music-function question |
Date: |
Thu, 12 Aug 2010 01:33:07 +0100 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.8) Gecko/20100802 Lightning/1.0b2 Thunderbird/3.1.2 |
Hi all,
In a recent piece I've had occasion to produce a trill mark with an
accidental above, and stealing from the manual, I came up with
g4(^\markup{
\tiny \center-column {
\flat \musicglyph #"scripts.trill" }
for example.
As this cropped up more than once I thought it would be a good idea to
write a music function:
trillflat = #(define-music-function
(parser location note) (ly:music?)
#{$note^\markup{
\tiny\center-column{ \flat \musicglyph #"scripts.trill" }} )
But the parser/lexer gets upset with the ^ and I suspect it doesn't like
the # between the '#{' and '#}'. If I could find the routine that
translates the note into scheme make-music call I could do something like
#(define (make-a-script x)
(make-music 'TextScriptEvent 'direction 1 'text x))
#(define (add-script m x)
(set! (ly:music-property m 'elements)
(cons (make-a-script x) (ly:music-property m 'elements)))
#(define add-flat-trill m)
(add-script m (markup
#:line
(#:tiny
(#:center-column
(#:flat #:musicglyph "scripts.trill"))))))
#( define-music-function (parser location note) (ly:music?)
(let (m ly:whatever($note)
; ^^^^^^^^^^^
; Is there a real lily routine I can use here?
;
(add-flat-trill (m) )
)
Is there a real procedure callable from scheme to turn g4 or whatever
into:
(make-music
'SequentialMusic
'elements
(list (make-music
'EventChord
'elements
(list (make-music
'NoteEvent
'duration
(ly:make-duration 2 0 1 1)
'pitch
(ly:make-pitch 0 4 0))))))
so I can modify it with the add-flat-trill routine?
Any suggestions so I can have some reusable code to define a modified
trill are welcome.
Cheers,
Ian
- define-music-function question,
Ian Hulin <=