lilypond-user
[Top][All Lists]
Advanced

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

Re: loco function which adds markup to the *next* musical moment


From: H. S. Teoh
Subject: Re: loco function which adds markup to the *next* musical moment
Date: Tue, 20 Oct 2015 09:46:41 -0700
User-agent: Mutt/1.5.24 (2015-08-30)

On Tue, Oct 20, 2015 at 12:03:37PM -0400, Kieren MacMillan wrote:
> Hello,
> 
> I’m trying to put together a bunch of syntactical sugar around
> octavation. (n.b. I am aware that there are open issues regarding
> octavation; even when those are solved, there will need to be some
> sugar.)
> 
> I would like to have a single command which ends an octavation *and*
> places the “loco” mark appropriately. Right now, I believe one needs
> two commands, e.g.
> 
>     \octU c’ d’ e’ f’ \loco g-\markup “loco”
> 
> If I just use a simple “single-moment” shorthand like
> 
>     loco = { \ottava #0 -\markup “loco” }
> 
> then obviously the markup would get placed incorrectly.
> 
> How can loco be defined so that it ends the octavation (and thus
> closes the OttavaBracket) at *this* moment, but postpones the markup
> until the *next* moment [in the same context], if one exists?
[...]

Here's my beginner's attempt at this:

        \version "2.19.2"
        loco = #(define-music-function (note) (ly:music?)
                (make-music 'SequentialMusic
                        'elements (list
                                (make-music 'OttavaMusic
                                        'ottava-number 0)
                                (make-music
                                        'NoteEvent
                                        'articulations (cons
                                                (make-music 'TextScriptEvent 
'text "loco")
                                                (ly:music-property note 
'articulations))
                                        'duration (ly:music-property note 
'duration)
                                        'pitch (ly:music-property note 'pitch))
                        )))
        \score {
                \new Staff {
                        \clef bass
                        c \ottava #1 d e f \loco g a b
                }
        }

I'm pretty sure there's a cleaner way of doing this, though.


T

-- 
Amateurs built the Ark; professionals built the Titanic.



reply via email to

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