lilypond-user
[Top][All Lists]
Advanced

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

Re: Discern single note-event from one in a chord


From: David Kastrup
Subject: Re: Discern single note-event from one in a chord
Date: Sun, 01 Jul 2018 12:24:38 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Urs Liska <address@hidden> writes:

> Well, the problem at hand is that I want to apply some styles, say a
> color, to the music passed into a music function. And depending on the
> type of music this should be done by wrapping the (sequential) music
> in \temporary \override .. \revert statements, by creating \tweaks or
> by issuing \once \overrides (which is necessary when the music is for
> example "\clef bass").
>
> I can discern between sequential and non-sequential music, and I can
> detect events that are not rhythmic-events. But I would like to be
> able to apply the wrapping to single music events too. For example
> when having a single note I'd like to override a number of grobs'
> color property while within a chord it's only the notehead, so \tweak
> is good.

>>> Is there maybe a way to get to a music's "parent" in order to check
>>> what type that is?
>> No.  A music function is a local transform.  It does not get to see
>> where its result is being used.  You can use its result in a variable
>> which you may use both as a single note and inside of a chord.
>>
>> If you want to work with music in context, you need to analyze stream
>> events in an engraver.
>>
>
> Hm, I don't think that's an option in my case. The problem is that in
> my \tagSpan function I *dispatch* the actual styling to another
> (user-provided) music function. And I think this has to be at the
> music-function stage because this function may not only override grob
> properties but may do anything a music function can do, like adding
> marks before or after the music or even apply some random procedure
> meddling with the content (I can imagine someone doing
>     \tagSpan randomize \with { strength = 0.9 seed = 0.49283567
> algorithm = original } { c c g' g a a g2 }
> )

So do both and use tags in-chord and not-in-chord (in a tag group of
their own) and add a scorification hook that removes all such tagged
music from where it does not belong.

> The problem is that
>     \tagSpan something c'
> often has to be treated differently from
>     <c' \tagSpan something e'>
>
> Any ideas toward that use-case, independent from my original problem
> description?

Either do both but tagged, or just tweak the stuff and do a pass through
the finished music (scorification hook or not) that replaces recognized
tweaks outside of chords with corresponding overrides.

This will not work very favorably with people using parallel music
inside of one context for piecing stuff together but if you want to do
that, you really need to iterate.

-- 
David Kastrup



reply via email to

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