Dynamics context doesn't work with polyphony(?)

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Dynamics context doesn't work with polyphony(?)

Martín Rincón Botero
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?

\version "2.20.0"

music = \relative c {
  \clef "bass"
  e\mf^"ord." ( fis4) << {f8^\markup { \center-align "div."} e->:64 es->:64 bes->:64 } \\ {f8\p e->:64 es->:64 bes->:64 } >>
}

\score {
  <<
  \new Staff
  \new Voice \with { \remove "Dynamic_engraver" } \music
  \new Dynamics \music
  >>
  \layout {
  \context {
    \Dynamics
    \override VerticalAxisGroup.nonstaff-relatedstaff-spacing.basic-distance = #0
    \remove "Script_engraver"
    \remove "Text_engraver"
    \remove "Text_spanner_engraver"
  }
}
}

Best regards,
Martín.

--

document.png (41K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Dynamics context doesn't work with polyphony(?)

Aaron Hill
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

Reply | Threaded
Open this post in threaded view
|

Re: Dynamics context doesn't work with polyphony(?)

Martín Rincón Botero
Hi Aaron,

thank you for your reply. I’ll try that later. Perhaps I should consider having a separate dynamics variable in the long run though. Potential issues like this could be so avoided by simply changing the problematic line of code. That would also allow me to have both the “normal” dynamics and the vertical aligned ones as needed, as suggested by other members in my other threads.

Cheers
Martín.

On Fri 11. Sep 2020 at 12:25 Aaron Hill <[hidden email]> wrote:
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



--