lilypond-user
[Top][All Lists]
Advanced

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

Re: How to create a thick horizontal line (as its own staff)?


From: David Nalesnik
Subject: Re: How to create a thick horizontal line (as its own staff)?
Date: Thu, 14 Jul 2016 07:35:08 -0500

Hi Mojca,

On Thu, Jul 14, 2016 at 4:41 AM, Mojca Miklavec
<address@hidden> wrote:
> Dear David,
>
> On 14 July 2016 at 00:01, David Nalesnik wrote:
>> On Wed, Jul 13, 2016 at 1:58 AM, Mojca Miklavec wrote:
>>>
>>> I would like to have:
>>>
>>> - a thick horizontal line for "push" and nothing at all on "pull", no
>>> vertical lines
>>>
>>> - it should start and stop at the vertical bar (if the push/pull stops
>>> at '|', otherwise "cover the appropriate durations" below the pitches)
>>>
>>> - probably something like \startPush to start the thick line, then
>>> perhaps specify the duration with something like "s1 s1", followed by
>>> \startPull that would disable
>>> (It would be soooooo much better if \startPush and \startPull could be
>>> placed in the first staff with melody, between the pitches, so that
>>> one wouldn't have to think twice about the proper duration of that
>>> thick line.)
>>>
>>> - the vertical position should be somewhere below the lyrics
>>
>> This is a situation which calls for a new Grob.  Unfortunately,
>> there's no user interface for doing this, but it is possible to mess
>> with internals and create the following file.  (Which I don't
>> guarantee :) )
>
> Wow! That's a piece of code!

There's a bit of duplication of non-public functions involved in grob
and event creation here.  If you were going to make a grob the
accepted way -- i.e, in the code base --, you would thankfully need a
bit less.

I commented out some stuff that I don't believe is needed here,
leftovers from the code for drawing text spanners that I adapted.

(I also renamed the engraver.)


>
> Based on your comment
>     % Change vertical position of spanner.  Sorry, not automatic.
>
> I just wanted to add that my intention wasn't to put the horizontal
> line into "arithmetic centre" of the whitespace between the staves.
> Actually it makes a lot more sense to keep the height of the line
> pretty much constant within a single line. So it looks better to me
> when I *remove*
>     \override Staff.AccordionPushSpanner.staff-padding = 2
> from the middle of the first line.
>
> Bottomline: what you thought to be a problem doesn't seem to be a
> problem at all.

Ah, OK.  Good.  I assumed that the push applied to both staves and so should be
centered like many piano dynamics. But as I say I know nothing about
accordion notation!

>
>> As far as position relative to lyrics, it's helpful to know that you
>> can override the direction property of the spanner.
>>
>> This is rough, but hopefully it will get you started.
>
> Wonderful. I will need some time to fully digest the code.
>
> One minor "problems" I noticed:
>
> In the basses I can use
>     f1-4^\markup {"f"}
> and the finger position is OK, but \markup{"f"} is placed above the
> horizontal line.
>
> This is not critical (yet?).

This isn't so hard to fix.  I added the outside-staff-interface to the
new Grob.  This handles
the stacking of objects above or below the staff.  You'd override the
property outside-staff-priority to get different
results.

>
>
> A few more questions (before I dive into the code):
>
> - Is there any rule or a guideline to decide whether to put repeats
> (\repeat volta 2 ...) in the upper or in the bottom stave?

No, put it in one or the other.  You can put it in both if you like..

>
> - The way you implemented these lines, is there a way to access the
> state (pushing or pulling) in the upper stave? (I would eventually
> want to do more complex things with it, but for simplicity let's say
> that I would want all the pitches in the upper stave to be red while
> pushing, or if I would additionally want to add \upbow or \downbow
> symbols in the upper line.) I'm not asking for the code to do the
> colouring just yet, I just want to know whether lilypond has access to
> the variable that would let me do it at some point.

Yes, this is the sort of thing you'd do with a music function.  The
coloring is simple; I've added a function to do that.

The function adds the push/pull events and simply introduces a
NoteHead override.  You'll see that the coloring function affects only
the objects in the Staff that it is applied to.  (You could
changes the overrides in the function to Score.NoteHead to get both
staves, but I take it that's not what you want.)

As far as downbows, that's doable as well.  It's a little more
Scheme-ish, though, and I'm not really awake yet :)  There are almost
certainly a number of snippets in the Lilypond Snippet Repository
(LSR) that do this -- automatic articulations with Scheme, something
like that.

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

One thing I'm not understanding is if you envision the push/pull
belonging exclusively to the upper staff, affecting both staves
together, or being placeable in either staff.

And also how lyrics relate.  My reason for putting the push/pull in
the lower staff in the original example is because that was the only
way I could get them to be above the horizontal line as you requested.
You can see that that is not the case in the current example (second
score) where the push/pull is in the upper staff.

I don't know how to control the placement of the Lyric context any
better than this.

Possibly the push/pull engraver should be in a Dynamics context. but
then we'd need to find another solution for getting colors and/or
downbows  into the upper staff.

>
> Many many thanks,
>     Mojca

You're welcome!

David

Attachment: accordion.ly
Description: Text Data


reply via email to

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