lilypond-user
[Top][All Lists]
Advanced

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

Re: Sending around contexts


From: Kieren MacMillan
Subject: Re: Sending around contexts
Date: Thu, 28 Oct 2021 14:03:21 -0400

Hi all!

I’m wondering if the state-of-the-art on pushing grobs to a “remote” context 
has improved since last year? I’ve included a snippet (below) from the thread 
which includes the message 
<https://lists.gnu.org/archive/html/lilypond-user/2020-11/msg00254.html>.

1. Instead of

    \pfdyn g'1 <>\mp

can grobs be “pushed” in a more intuitive/natural way, e.g.

    g'1 -\pfdyn -\mp

2. Maybe even better: Would a Scheme engraver be able to extract (and 
“delete”/omit) *all* dynamics from one context (e.g., the piano_upper context) 
and inject them into a second context (e.g., piano_dynamics)? If so, what would 
be the most elegant way of indicating that a single/particular dynamic marking 
*shouldn’t* be extracted/pushed by the engraver?

Thanks,
Kieren.

p.s. David K: I added you as a CC because you know your way around the Lilypond 
insides better than anyone I know! Apologies if the direct-email was 
inappropriate.


%%%  SNIPPET BEGINS  %%%
\version "2.22.1"

\layout {
  \context {
    \name "Notes"
    \type "Engraver_group"
  }
  \context {
    \Voice
    \accepts "Notes"
  }
  \context {
    \name "Container"
    \type "Engraver_group"
    \accepts "Notes"
    \accepts "Voice"
  }
  \context {
    \Staff
    \accepts "Container"
  }
  \context {
    \Dynamics
    \accepts "Container"
  }
}

send =
#(define-music-function (cname context music1 music2) (string? string? 
ly:music? ly:music?)
   #{
     << #music1 \new Container \new Notes { \change #cname = #context #music2 } 
>>
   #})

pfdyn = \send Container "piano_dynamics" \etc

piano_upper = {
  c'4\p d' e' f'
  \pfdyn g'1 <>\mp
  g'4\f f' e' d'
  c'1
}

piano_lower = {
  \clef bass
  c1
  g,1
  g,1
  c1
}

\score {
  <<
    \new PianoStaff <<
      \new Staff \piano_upper
      \new Dynamics \new Container = "piano_dynamics" s1
      \new Staff \piano_lower
    >>
  >>
  %%%  layout mod to show the centred dynamics
  \layout {
    \context {
      \PianoStaff
      \override VerticalAxisGroup.staff-staff-spacing.padding = #10
    }
  }
}
%%%  SNIPPET ENDS  %%%

________________________________

Kieren MacMillan, composer (he/him/his)
‣ website: www.kierenmacmillan.info
‣ email: kieren@kierenmacmillan.info




reply via email to

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