Valentin & Lukas,

Thank you both. These solutions far exceed what I'd been hoping for.
I'll play around with these functions to see which works best for me.

Thanks you again,
Greg

On Fri, Jan 7, 2022 at 5:39 PM Valentin Petzel <valen...@petzel.at> wrote:

> Hi Greg, Hi Lukas,
>
> Here is a slightly more powerful approach.
>
> Cheers,
> Valentin
>
> Am Freitag, 7. Jänner 2022, 23:14:41 CET schrieb Lukas-Fabian Moser:
> > Hi Greg,
> >
> > Am 07.01.22 um 22:05 schrieb Gregory Hollands:
> > > This solution sounds ideal.
> > > I would prefer to add the articulations directly to the music and just
> > > filter them out when necessary.
> >
> > Valentin already gave a solution involving a music function.
> >
> > A dynamic solution (that might be switched on and off during a piece)
> > would be:
> >
> > \version "2.22"
> >
> > removeArticulations =
> > #(define-music-function (types) (list?)
> >     #{
> >       \override Script.before-line-breaking =
> >       #(lambda (grob)
> >          (if (member (ly:event-property (event-cause grob)
> >                                         'articulation-type)
> >                      types)
> >              (ly:grob-suicide! grob)))
> >     #})
> >
> > \layout {
> >    \removeArticulations #'("downbow" "upbow")
> > }
> >
> > { c'4\downbow d'\upbow }
> >
> > Note that this will not work anymore with 2.23.6; the corresponding
> > solution will then be a bit nicer syntax-wise:
> >
> > \version "2.23.6"
> >
> > removeArticulations =
> > #(define-music-function (types) (symbol-list?)
> >     #{
> >       \override Script.before-line-breaking =
> >       #(lambda (grob)
> >          (if (memq (ly:event-property (event-cause grob)
> >                                         'articulation-type)
> >                      types)
> >              (ly:grob-suicide! grob)))
> >     #})
> >
> > \layout {
> >    \removeArticulations downbow, upbow
> > }
> >
> > { c'4\downbow d'\upbow }
> >
> > Also Valentin's solution will have to be changed to:
> >
> > \version "2.23.6"
> >
> > chooseArticulations =
> > #(define-music-function (arts music) (symbol-list? ly:music?)
> >     (define (predicate music)
> >       (if (music-is-of-type? music 'articulation-event)
> >           (let ((type (ly:music-property music
> >                                          'articulation-type)))
> >             (memq type arts))
> >           #t))
> >     (music-filter predicate music))
> >
> > Chords = \chords {
> >     \set chordChanges = ##t
> >     c1 c1 f2 g2 c1
> > }
> >
> > Music = \relative c' {
> >     e8\downbow dis e g\upbow ~ g4 e\downbow
> >     g8 a g c ~ c8 b c d
> >     e d c b c d4 c8 ~
> >     c2. r4
> > }
> >
> > \chooseArticulations downbow <<
> >    \Chords
> >    \new Staff \new Voice <<
> >      \Music
> >    >>
> >
> >
> > \chooseArticulations upbow <<
> >    \Chords
> >    \new Staff \new Voice <<
> >      \Music
> >    >>
> >
> >
> > \chooseArticulations downbow, upbow <<
> >    \Chords
> >    \new Staff \new Voice <<
> >      \Music
> >    >>
> >
> >
> > Although I'm a bit surprised that Valentin let you choose what
> > articulations to keep instead of what articulations to remove. This
> > would be done with:
> >
> > removeArticulations =
> > #(define-music-function (arts music) (list? ly:music?)
> >     (define (predicate music)
> >       (if (music-is-of-type? music 'articulation-event)
> >           (let ((type (ly:music-property music
> >                                          'articulation-type)))
> >             (not (member type arts)))
> >           #t))
> >     (music-filter predicate music))
> >
> > or from 2.23.6
> >
> > removeArticulations =
> > #(define-music-function (arts music) (symbol-list? ly:music?)
> >     (define (predicate music)
> >       (if (music-is-of-type? music 'articulation-event)
> >           (let ((type (ly:music-property music
> >                                          'articulation-type)))
> >             (not (memq type arts)))
> >           #t))
> >     (music-filter predicate music))
> >
> > with the corresponding changes in calling syntax.
> >
> > Lukas

Reply via email to