lilypond-user
[Top][All Lists]
Advanced

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

Re: Sending around contexts


From: Martín Rincón Botero
Subject: Re: Sending around contexts
Date: Sat, 21 Nov 2020 21:27:27 +0100

Nice! Perhaps in the realms of Dynamics contexts this could be the seed for a future centered dynamics "style" —where dynamics are sent "behind the scenes" to a Dynamics context— that's activated with a simple \override command.

Am Sa., 21. Nov. 2020 um 21:16 Uhr schrieb Kieren MacMillan <kieren_macmillan@sympatico.ca>:
Hi Valentin (et al.),

Oh, this is so great…!!  =)

FAIRLY MINIMAL EXAMPLE:

%%%
\version "2.20"

\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"
  }
}

toDyn =
#(define-music-function (music1 music2) (ly:music? ly:music?)
   #{
     << #music1 \new Container \new Notes { \change Container = "piano_dynamics" #music2 } >>
   #})

piano_upper = {
  c'4\p d' e' f'
  \toDyn g'1 s1\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
    }
  }
}
%%%

Question: Can the interface be made into a \tweak-able function, where the parameters are [only] the name of the target context and the music being sent there?

Very exciting!
Kieren.
________________________________

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




--
www.martinrinconbotero.com

reply via email to

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