lilypond-user
[Top][All Lists]
Advanced

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

Re: Syntax for multiple slurs per Voice?


From: David Kastrup
Subject: Re: Syntax for multiple slurs per Voice?
Date: Fri, 02 Oct 2015 16:48:28 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

Kieren MacMillan <address@hidden> writes:

> Hi David,
>
>> issue 4625 in the tracker
>> <URL:https://sourceforge.net/p/testlilyissues/issues/4625/> is the final
>> straw to provide an actual input syntax for setting the spanner-id
>> property introduced before version 2.16.
>
> Fabulous!
>
>> How do people feel about choosing one of the following variations of
>> \- and \= (code compiles and does the expected thing even in 2.18):
>
> I think I prefer \=, but I would be happy with either.
>
>> Other options I have thought about would be \# but it turns out that
>> looks really clunky and works worse logically with strings than with
>> numbers.  Also it might be more trouble with syntax highlighting because
>> of already existing meanings of # .
>
> Is this possibly the right time/situation to finally use the
> [currently unused, I believe??] @?

Well, this would turn the test code into
\version "2.18.0"

"@" =
#(define-event-function (parser location id ev) (number-or-string? ly:event?)
  (set! (ly:music-property ev 'spanner-id)
        (if (number? id) (number->string id) id))
  ev)

"\\=" =
#(define-event-function (parser location id ev) (number-or-string? ly:event?)
  (set! (ly:music-property ev 'spanner-id)
        (if (number? id) (number->string id) id))
  ev)

"\\-" =
#(define-event-function (parser location id ev) (number-or-string? ly:event?)
  (set! (ly:music-property ev 'spanner-id)
        (if (number? id) (number->string id) id))
  ev)

\relative { c'@1( address@hidden( address@hidden) address@hidden) }

\relative { c'\=1( d\=2( e\=1) f\=2) }

\relative { c'\-1( d\-2( e\-1) f\-2) }

% should we prefer this variant in the docs?

\relative { c'\-1-( d\-2-( e\-1-) f\-2-) }

% if so, how to write slur directions?

\relative { c'\-1^( d\-2_( e\-1-) f\-2-) }

\relative { c'^\-1-( d_\-2-( e\-1-) f\-2-) }

% using simple strings

\relative { c'@x( address@hidden( address@hidden) address@hidden) }

\relative { c'\=x( d\=y( e\=x) f\=y) }

\relative { c'\-x( d\-y( e\-x) f\-y) }

\relative { c'\-x-( d\-y-( e\-x-) f\-y-) }
I'm not particularly fond of that but it does get rid of the backslash.
Personally I'd rather keep @ for user extensions.

At any rate, a nice idea might be to have a context property slur-ids
(and phrasing-slur-ids and beam-ids) that can be set to a list and will
then cause the Slur_engraver to only look at slurs in that set of ids.

Where is the point?  You can then do something like

\layout {
  \context {
    \Voice
    slur-ids = #'("" "1" "2")
  }
  \context {
    \Staff
    \consists "Slur_engraver"
    slur-ids = #'("3" "4")
  }
}

and then spanner-id "3" or "4" will work for cross-Voice slurs.  I'm not
entirely convinced of the concept since it requires a lot checking at
each involved level and one will likely want to do the same for other
engravers so that one has to wonder if it would not be better to
filter/distribute events before they even reach engravers.

But it would be comparatively simple to implement.

-- 
David Kastrup

reply via email to

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