Am Donnerstag, 11. April 2024, 19:11:45 CEST schrieb Walt North:
> Hello, I would appreciate some help with this music function.
> 
> The end goal is have a define function produce a glissando after a note
> going either up or down to
> 
> undetermined second note.  For example a guitar slide down off the note.
> 
> I can get the behavior I want with a line of code directly in the score
> but not by using a function.
> 

Hello Walt,

The reason is that \glissando does not in fact behave the way you think is 
does. \glissando is a special kind of event we call afterevent — which is 
basically a function \glissando note which is applied in postfix notation note-
\glissando. This means that such an event needs to be handled specially by the 
parser. As not every code is exactly correct in this sense the parse will try 
to find such post events that are not attached to anything, and try to find a 
previous note it can be attached to.

This means that other than c-\glissando you can also do {c}\glissando or 
whatever.

But if you have a function like \afterGrace and then do #startNote \glissando 
... the parser will see this as two different entities and therefore call 
\afterGrace with the arguments #startNote and \glissando — thus the grace part 
will not actually be inserted as grace, but as regular notes, which causes the 
bar check failure, and the glissando will be started without any notehead.

To fix this you could simply do

\afterGrace 1 { #startNote \glissando } ...

Cheers,
Valentin

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to