On 2020-09-11 1:56 am, Martín Rincón Botero wrote:
Hello,
sorry to bother again. I've been further exploring the Dynamics
context. I
just noticed that when there's a polyphonic passage, not only dynamics
don't align anymore, but also \remove engravers fails to do its job. Is
this a bug or is there any other engraver I should remove from the
Dynamics
context so that notes and text are not duplicated in polyphonic
passages?
The issue seems to be with the << \\ >> construct implicitly referencing
named Voice contexts. Events within the Dynamics context are
unintentionally leaking into the existing contexts and doubling the
notes. Consider:
%%%%
\version "2.20.0"
musicI = << b'2\f \\ { g'4 4 } >>
<< \new Voice \musicI \new Dynamics \musicI >>
musicII = << \context Voice = "1" { \voiceOne b'2\f }
\context Voice = "2" { \voiceTwo g'4 4 } >>
<< \new Voice \musicII \new Dynamics \musicII >>
%%%%
While I may be overlooking some details, the above expressions are
logically equivalent. That makes the << \\ >> construct tricky when
being reused for Dynamics.
Stripping out the VoiceSeparator *might* work:
%%%%
removeVoiceSeparator =
#(define-music-function (music) (ly:music?)
(define (not-music-separator? m) (not (music-separator? m)))
(music-filter not-music-separator? music))
<< \new Voice \musicI
\new Dynamics \removeVoiceSeparator \musicI >>
%%%%
Whether this brings about new issues, I could not say.
-- Aaron Hill