lilypond-user
[Top][All Lists]
Advanced

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

Re: Writing a function


From: David Kastrup
Subject: Re: Writing a function
Date: Sun, 12 May 2019 12:40:31 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Rok Kršmanc <address@hidden> writes:

> Hi!
>
> I would like to write a function for the next music expression:
> \once \override TextScript.extra-offset = #'(0 . 1)
> c^"o"
>
> Here is my try:
> f =
> #(define-music-function (parser location offset music)
>   (number? ly:music?)
>   #{
>     \once \override TextScript.extra-offset = #'(0 . $offset)
>     $music ^"o"
>   #})
>
> When I call this function:
> \f #1 c
>
> I get syntax error:
> unexpected '^'
>
> What am I doing wrong?

First it seems like a bad idea to redefine \f ("forte").  But the main
problem is that an expression like $music cannot take articulations
(this has been ameliorated to some degree in current development, likely
appearing as 2.21 eventually).

You can achieve about the same effect with << $music <>-"o" >> namely
putting the articulation instead on a simultaneously executing empty
chord.

-- 
David Kastrup



reply via email to

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