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: Mojca Miklavec
Subject: Re: How to create a thick horizontal line (as its own staff)?
Date: Thu, 14 Jul 2016 17:24:29 +0200

Hi,

Just as an exercise I went on reading different parts of the manuals
and also came up with an alternative "poor man's" solution that
achieves the desired output, but would be way more tedious to input.
I'm attaching it nevertheless (maybe it turns out that parts of the
complex code could be simplified).

On 14 July 2016 at 14:35, David Nalesnik wrote:
> 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!

Yes, push applies to both staves of course (with a bit of humour:
pushing open part and pulling the other would probably result in
translation of the instrument rather than music :) :) :) :).

But I admit that I don't have that much experience with music notation
(and even less with high quality one) nor did I ever play anything
else than some very simple songs on piano, so I don't know how exactly
it is (should be) done there.

To be honest the horizontal line is not the most pleasing one to the
eye, but it's hard to miss :), it seems to be "universally" accepted
among different parts of my country (even when people write just
button names for beginners without proper pitches) and if one gets
lost and wants to restart playing at some point, there's no need to
search back for the last direction changing sign.

It is also possible that they started using a horizontal line just
because that was the easiest thing to draw/add to the scores.

I checked one of the scores I got and the lines are in fact not
aligned vertically. They might indeed be "centered in the empty space
between the staves", but the effect is not noticeable because the
differences in line heights are just minor ones.

>>> 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.

Thank you. But now the line from the 8th bar on is too close to the
bottom stave (and in the second example the last horizontal line is
too close to the upper stave).

It looks slightly better if I add >c'< to the basses of the first
example or >c< to the main melody of the second example.

>> 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..

OK, great, thank you.

>>
>> - 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.)

What I meant was rather the following:

\new PianoStaff <<
  \new Staff {
    f'1
    \startPush
    f'
    \startPull
    f'
  }
  \new Staff {
    \clef bass
    f1
    f % some magic to make this one red automatically
    f
  }
>>

I don't really need to colour the music notes, but I would eventually
like to come up with a function that would do different things
depending on push/pull direction (for example implement a function
\drawPitchForBass that would draw C or G for the argument "2"
depending on whether one is pushing or pulling, and put a number 2
below the pitch).

But again, this is out of scope of this particular question/topic.

> 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.

I'll search though it.

> %%%%%%%%%%%%%%
>
> 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.

It should affect both staves together (ideally I would specify it just
in one of the staves and the other one would know about it). Drawing
the line in the middle of both staves is just the most sensible way to
typeset the music piece.

Actually, I would like to be able to add \startPush/\startPull in the
first staff / top stave and then be able to change a single definition
in the common style file, so that all the scores in that directory
could either use horizontal lines or upbow/downbow without changing
each score individually.

> And also how lyrics relate.

Usually it's (from top to bottom):

- (optional) names of buttons and/or fingers
- first stave / melody
- lyrics
- horizontal line to mark push/pull
- (optional) whatever markings are needed for the basses (could be
fingers, staccato, ...)
- second stave / basses
- (optional) whatever markup might be needed below (very often there
is the button number to help people who don't know musical theory)


I need to add that many people who play the instrument know absolutely
nothing about the music theory and are not able to read the scores.
Until recently the instrument has never been taught in music schools
and most people have learnt it on their own simply by trying out what
sounded right. Many of them are usually able to repeat any melody they
hear.

But even for those who know the scores and are only starting playing
the instrument it's super difficult to remember which pitch belongs to
which of the 30+ buttons. The pitch also changes when playing
direction changes, making the whole thing even trickier. Playing form
"button labels" (A2, C5, B4, ...) is thus much much easier and many
still learn just the "button name notation" without ever learning any
theory. Teachers also rarely use anything else but the button labels.

The "best" scores for beginners contain all of the following elements:
- all the pitches in both staves (melody + basses), even if everyone
ignores them
- all button names for both staves
- all finger numbers (at least for the upper stave)
- lyrics
- playing direction

> 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.

Yes, that one looks a bit weird as soon as the lyrics are missing and
the spacing becomes too narrow.

> 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.

Thinking about it ...

When using
    \repeat volta 2 {}
it is sufficient to put the repeat in one stave and it is also
correctly placed in all other staves.

I don't know how this is achieved, but a similar approach could be
used to create three staves:

1. first stave with melody

2. second stave with decreased spacing below and above and
  \override Staff.StaffSymbol.line-count = #1
  \override Staff.StaffSymbol.thickness  = #6
and whenever the direction switched (the switch being done in the
first stave), just use \startStaff and \stopStaff to display and hide
that line.

3. third stave with basses

The direction change could be signalled in either the first or the
third stave and the second stave could be drawn more or less
automatically.

Mojca

Attachment: playing-with-staves.ly
Description: Binary data


reply via email to

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