[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Mysterious behavior in music function
From: |
Marc Evanstein |
Subject: |
Re: Mysterious behavior in music function |
Date: |
Mon, 5 Aug 2019 00:50:50 +0000 (UTC) |
Thanks so much for this explanation, and for the working version that does
exactly what I wanted! It's very much appreciated.
Marc
Marc Evanstein
www.marcevanstein.com
Sun Aug 04 16:07:28 PDT 2019 Thomas Morley <address@hidden>:
> Am So., 4. Aug. 2019 um 22:49 Uhr schrieb Marc Evanstein
> <address@hidden>:
> >
> > Hi all,
> >
> > I'm trying to define a music function that adds a gliss after a note down
> > to a second parenthesized grace note. I've tried the following, but the
> > gliss doesn't show up:
> >
> > \version "2.19.83"
> > \language "english"
> >
> > bendDown =
> > #(define-music-function
> > (parser location firstNote secondNote)
> > (ly:music? ly:music?)
> > #{
> > \afterGrace
> > $firstNote
> > \glissando
> > \once \override Stem.stencil = ##f
> > \once \override Flag.stencil = ##f
> > \parenthesize $secondNote
> > #}
> > )
> >
> > \score {
> > \new Staff \with { instrumentName = #"Flute" }
> > {
> > \bendDown g'2 f'4
> > }
> > }
> >
> > More than this, what I'm truly puzzled by is that if I remove "\afterGrace"
> > and just let the second note be a normal note, I get an error:
> >
> > error: syntax error, unexpected EVENT_IDENTIFIER
> >
> > \glissando
> >
> > If I copy paste the function text replacing the variables, then I get
> > almost what I want, except that the stem of the grace note is still there:
> >
> > \score {
> > \new Staff \with { instrumentName = #"Flute" }
> > {
> > \afterGrace
> > g'2
> > \glissando
> > \once \override Stem.stencil = ##f
> > \once \override Flag.stencil = ##f
> > \parenthesize f'4
> > }
> > }
> >
> > What does seem to totally work is to use a regular grace instead of an
> > afterGrace, except that I can't seem to write it as a music function
> > without getting that same "unexpected EVENT_IDENTIFIER" error:
> >
> > \score {
> > \new Staff \with { instrumentName = #"Flute" }
> > {
> > g'2
> > \glissando
> > \grace
> > \once \override Stem.stencil = ##f
> > \once \override Flag.stencil = ##f
> > \parenthesize f'4
> > }
> > }
> >
> > Can anyone shed some light on this for me?
> >
> > Thanks in advance!
> >
> > Marc
>
> Hi Marc,
>
> two Problems:
> (1)
> A postevent can't be attached to a music-variable, this feature will
> be likely be available with next stable. See:
> one = c'4
> two = d'4
> { $one \glissando $two }
> which returns the known error.
> But you can workaround by attaching the postevent to an empty chord in
> front of the musical variable, then it will be "sort of merged" with
> the note:
> one = c'4
> two = d'4
> { <>\glissando $one $two }
>
> (2)
> afterGrace expects _two_ musical arguments.
> Your code
> > #{
> > \afterGrace
> > $firstNote
> > \glissando
> > \once \override Stem.stencil = ##f
> > \once \override Flag.stencil = ##f
> > \parenthesize $secondNote
> > #}
>
> provides $firstNote as first argument and \glissando as the second.
> (And there is an optional argument for the `fraction´)
>
> You will want to have a first-note-with-starting-glissando as first argument
> and
> a parenthesize-second-note-with-overrides as second. Thus use brackets:
>
> bendDown =
> #(define-music-function
> (parser location firstNote secondNote)
> (ly:music? ly:music?)
> #{
> \afterGrace 15/16
> {
> <>\glissando
> $firstNote
> }
>
> {
> \once \override Stem.stencil = ##f
> \once \override Flag.stencil = ##f
> \parenthesize $secondNote
> }
> #}
> )
> \score {
> \new Staff \with { instrumentName = #"Flute" }
> {
> \bendDown g'2 f'4
> }
> }
>
> Works here.
>
> HTH,
> Harm
>