lilypond-user
[Top][All Lists]
Advanced

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

Re: \omit-ing a specific type of Script [globally or via edition-engrave


From: Lukas-Fabian Moser
Subject: Re: \omit-ing a specific type of Script [globally or via edition-engraver]
Date: Sun, 26 Dec 2021 17:19:59 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0


Am 26.12.21 um 17:13 schrieb Lukas-Fabian Moser:
Hi Kieren,

Am 26.12.21 um 16:48 schrieb Kieren MacMillan:
Hi all,

Given

\version "2.21"
{ \omit Script c''1^\fermata_\espressivo }

obviously both Script grobs will be omitted; same, of course, with

\version "2.21"
\layout { \context { \Score \omit Script } }
{ c''1^\fermata_\espressivo }

Is there a way (e.g., via callback or improved \omit function definition) to make \omit more surgical? For example, can one effectively say

     \omit #'(fermata) Script

so that only fermatas get omitted?

Perhaps something like:

Or, with a little bit more sugar:

\version "2.22"

omitScriptTypes =
#(define-music-function (types) (symbol-list?)
   (let
    ((stencil
      (lambda (grob)
        (if (memq
             (string->symbol
              (ly:event-property (ly:grob-property grob 'cause)
                                 'articulation-type))
             types)
            #f
            ly:script-interface::print))))
    #{
      \override Script.stencil = #stencil
    #}))

example = { a'4\fermata a'\tenuto a'\espressivo a'\marcato }

{
  \omitScriptTypes fermata
  \example
  \omitScriptTypes fermata, tenuto
  \example
  \omitScriptTypes tenuto, espressivo, marcato
  \example
  \omitScriptTypes #'()
  \example
}

(I'm a bit surprised that the articulation type is stored in a string instead of a symbol; maybe there's another property that I'm overlooking, as my call to string->symbol isn't really what you would call elegant.)

Lukas




reply via email to

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