Hi Mojca,

On Wed, Jul 20, 2016 at 10:05 AM, Mojca Miklavec
<[email protected]> wrote:
> Dear David (and others),
>
> One further thought.
>
> Given that it's super difficult to "transfer" information "across staves" ...
>
> Would it be feasible to allow the following input syntax (or something 
> similar)?
>
>     melody = { c a c \startPush f g a \stopPush h c d }
>     \new PianoStaff <<
>         \new Voice = "melody" \fixed c' {
>           \melody
>        }
>        \new Dynamics \with {
>          \override VerticalAxisGroup.nonstaff-nonstaff-spacing.padding = 1
>        } {
>          \melody
>        }
>     >>
>

With the example I gave above, this would work fine.  The horizontal
line engraver is only consisted to the Dynamics context, so the
push/pull events will only produce a line there.  Conversely, the
Dynamics context won't typeset the notes.

You will run into problems with this approach if you add dynamics to
your melody, however, since they will of course appear in the Dynamics
context.

The best solution would be to define your own context.  (Instructions
for doing this are found here:
http://lilypond.org/doc/v2.19/Documentation/notation/defining-new-contexts)

I've gone ahead and defined an "AccordionPushPull" context which
modifies the definition of a Dynamics context (definition found in
engraver-init.ly in the source) to include the horizontal line
engraver and nothing else.  So you can safely include your melody
variable and not need to worry about extraneous elements being
typeset.


> There are modes like "\new RhythmicStaff" that discard half of the
> information about the scores.
>
> I would be super happy if there was a way to enter the input
> information only once because repeating it twice is calling for
> errors. But also because \startPush and \stopPush could then do
> different things inside the main melody.
>
> The "\new Voice" could ignore the \startPush/\stopPush directives (or
> do something special with them) and "\new Dynamics" could ignore
> typesetting the actual musical notes. I don't know how much tweaking
> of LilyPond internals would be needed to achieve that though.

In this case, I believe you'd need to write another engraver.  It
would listen for the push and pull events and do something different,
like create the downbows or color notes.  No problem at all.

Hope this helps--

David N

P.S. I've attached two files, showing how you can cut down on the
clutter in your input file by using an include.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Attachment: accordion.ily
Description: Binary data

\version "2.19.30"

\include "accordion.ily"

global = {
  \time 2/4
  \key f \major
}

melody = {
  \global
  \partial 4 c'8 c'
  c'8 c'4 c'8~
  c'8 c'4 d'8~
  d'4 e'8 e'~
  e'8 f'4.~
  f'2~
  f'8 a a a
  a8 bes c' \startPush c'~
  \break
  c'8 d'4.~
  d'2~
  d'8 c' c' c'
  c'8 bes a \startPull g~
  g2~
  g2~
  g8 c' s4
}

\new PianoStaff <<
  \new Staff <<
    \new Voice = "melody" {
      \melody
    }

    \new Lyrics \lyricsto "melody" {
      \repeat unfold 50 { "foo" }
    }
  >>

  \new AccordionPushPull \with {
    \override VerticalAxisGroup.nonstaff-nonstaff-spacing.padding = 1
  } {
    \melody
  }

  \new Staff = "staff" <<
    \new Voice = "bass" {
      \clef bass
      \global
      r4
      R2*3
      \repeat unfold 7 { d,8 <d f a> }
      c,8 <e g c'>
      \repeat unfold 3 { bes,,8 <d f bes> f, <d f bes> }
      bes,8 <d f bes> f, <e g c'>
      \repeat unfold 2 { c,8 <e g c'> g, <e g c'> }
      c,8 <e g c'> c, d,
    }
    \new Lyrics \with {
      alignAboveContext = "staff"
    }
    \lyricmode {
      \skip 4
      \skip 2*3
      "9"8 "8" "9" "8"
      "9" "8" "9" "8"
      "9" "8" "9" "8"
      "9" "8" "4" "1"
      "6" "5" "4" "5"
      "6" "5" "4" "5"
      "6" "5" "4" "3"
      "4" "3" "2" "3"
      "4" "3" "2" "3"
      "4" "3" "4" "9"
      "7" "6" "7" "9"
    }
  >>
>>

\layout {
  ragged-last = ##t
}
_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to