lilypond-devel
[Top][All Lists]
Advanced

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

Re: [Patch] make post-event music functions direction-aware (issue374304


From: v . villenave
Subject: Re: [Patch] make post-event music functions direction-aware (issue3743043)
Date: Tue, 21 Dec 2010 22:12:46 +0000

On 2010/12/21 21:24:52, Carl wrote:
I can't understand why you don't want to push a patch that breaks all
your
scores... ;-)

Does this latest patch break your scores?

It does, since the 'direction property is never left null (I can work
around it, though. But at first I did feel a bit shocked, I must say :-)

What is the logical distinction you want to make between a neutral
direction and
the lack of an explicit direction?

I'm a bit nervous about using an undocumented lack of a direction
setting as a
signal to do something.  It seems to me to be not very robust.

It may not be robust, but it's actually very convenient.
Please bear with me for a little while, I'll try to explain.

The nicest way to write a piano part with centered dynamics is
currently:

\new PianoStaff <<
  \new Staff \rightHand
  \new Dynamics \myDynamics
  \new Staff \leftHand



The downside is: writing dynamics separately in a variable filled with
skips and rests, is quite cumbersome. I much prefer writing the dynamics
on the fly with the right- or left-hand music (or ideally, both).  So,
what if I could somehow extract the dynamics from these music
expressions and gather them in the Dynamics context?

\new PianoStaff <<
  \new Staff \removeDynamics \rightHand
  \new Dynamics \keepOnlyDynamics << \rightHand \\ \leftHand >>
  \new Staff \removeDynamics \leftHand

http://repo.or.cz/w/opus_libre.git/blob/HEAD:/lib/80-buildskel.scm#l174
http://repo.or.cz/w/opus_libre.git/blob/HEAD:/lib/80-buildskel.scm#l81

I *could* do this only with contexts and engravers. However, a new issue
arises: sooner or later, I'm bound to have to print some dynamics above
the upper staff, or below the lower staff (or even: below the upper
staff, *but* not vertically centered, but instead closer to the relevant
staff). Which I won't be able to do if I've removed the
Dynamics_engraver from the Staff context. What to do?

There we go: I have to use a music-filter, much like \keepWithTag or
\removeWithTag, only it will check for explicit directions.
http://repo.or.cz/w/opus_libre.git/blob/HEAD:/lib/libdynamic.scm#l58


This way, I can do:

rightHand = \relative c' {
  c1\f %% This will be sent to the Dynamics context
  c^\f %% This will be printed above the upper staff
  c_\f %% This will be printed below the staff, but closer to the upper
staff.
  c\< %% I can even begin a crescendo here...
  c
}

leftHand = \relative c { \clef bass
  c1 c c c c\ff %% ... And finish it here.
}

It's a hell of a hack (as is my whole framework anyway), and it does add
a considerable overhead. But boy, do my scores look good! :-)

Cheers,
Valentin.

http://codereview.appspot.com/3743043/



reply via email to

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