[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Articulations in Separate Voice
From: |
Lukas-Fabian Moser |
Subject: |
Re: Articulations in Separate Voice |
Date: |
Fri, 7 Jan 2022 23:14:41 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 |
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