[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: |
Sat, 21 Nov 2020 15:59:39 -0500 |
Hi Valentin,
> Specifiying the context name is easy, that’s just a markup:
> toDyn =
> #(define-music-function (music1 music2 context) (ly:music? ly:music? markup?)
> #{
> << #music1 \new Container \new Notes { \change Container = #context
> #music2 } >>
> #})
Excellent!
An improved/expanded snippet:
%%%%
\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"
}
}
send =
#(define-music-function (contextname music1 music2) (string? ly:music?
ly:music?)
#{
<< #music1 \new Container \new Notes { \change Container = #contextname
#music2 } >>
#})
pd = \send "piano_dynamics" \etc
piano_upper = {
c'4\p d' e' f'
\pd 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
}
}
}
%%%%
> For the other thing I do not think it is possible. Tweaking would tweak a
> property of the music, and Lilypond only allows for post events, but not for
> postscript functions. So I do no think it would be possible to get both music
> parts into parallel.
Perhaps David K can see a way to get around this? =)
Thanks again!
This function will REALLY change (read: improve) the way I can code my music.
Best,
Kieren.
________________________________
Kieren MacMillan, composer (he/him/his)
‣ website: www.kierenmacmillan.info
‣ email: kieren@kierenmacmillan.info
- Sending around contexts, Valentin Petzel, 2020/11/21
- Re: Sending around contexts, Kieren MacMillan, 2020/11/21
- Re: Sending around contexts, Kieren MacMillan, 2020/11/21
- Re: Sending around contexts, Lukas-Fabian Moser, 2020/11/21
- Re: Sending around contexts, Valentin Petzel, 2020/11/21
- Re: Sending around contexts, Kieren MacMillan, 2020/11/21
- Re: Sending around contexts, Valentin Petzel, 2020/11/21
Re: Sending around contexts, Valentin Petzel, 2020/11/21