Learning Lilypond, comments invited - part 2

classic Classic list List threaded Threaded
16 messages Options
Reply | Threaded
Open this post in threaded view
|

Learning Lilypond, comments invited - part 2

Colin Tennyson
I'm creating a new thread because the previous one has become somewhat cluttered.

My template is much better now, thank you for your suggestions.

As emphasized by David Kastrup, the keyword \new instructs Lilypond to create a new instance of a class.
\new StaffGroup creates an instance of the StaffGroup object.

In this template several properties of the Score class are modified, such as:    
\hide Score.SystemStartBracket
\override Score.BarNumber.font-size = #1.5

I surmise that the StaffGroup object inherits from the Score object, similar to inheritence in object oriented programming.



Again, this is the first 10 measures and the upper 2 staffs of a 100 measure, 4 staff score.

I'm pleased with the separations in this template.
- The declaration of the nesting structure now contains only the nesting of the elements
- Properties of the elements are all declared in \layout


One thing remains: the property "forbid_line_break_engraver" is a property of the element Voice
If possible I want to avoid repeating commands. I don't want to put in the \remove "forbid_line_break_engraver" four times, for every voice in the score.

For the other properties I was able to use a dot notation access. Examples:
\hide Score.SystemStartBracket
\override Staff.InstrumentName.self-alignment-X = #RIGHT    

The accessor \context allows the property to be set centrally:
\context { \Voice \remove "Forbid_line_break_engraver" }

But is just a side effect? Is \context meant for something else entirely?
Can the property "forbid_line_break_engraver" also be accessed using a dot notation?





++++++++++++++++++++++++++++++++++++++++++++++++

\version "2.18.0"
\language "english"

% 't' as in 'test' or 'transcribing an existing score'
tBreak = { \break }
ficta = { \once \set suggestAccidentals = ##t }
addKey = { \key c \major  \time 4/4 }

barSetup = {
  \hide Staff.BarLine  %{ for the Mensurstriche: inside the staff hide the barline %}
  s1 |         s1 |         s1 | \tBreak s1 |         s1 |         %05
  s1 |         s1 |         s1 | \tBreak s1 |         s1 |         %10
  \undo \hide Staff.BarLine \bar "||"  % final barline visible
}
staffOneNotes =  \relative c'' {
      g1 | g2 a2 | b2 g2 | r2 a2 | d2. c4 | %005
      b2 a2 | r4 d4 d4 b4 | c4. b8 a8[ g8] a4. g8[ f8 e8] d4 a'2  g2 \ficta fs4 |  %010
}
staffOneWords = \lyricmode {
  San -- cta Ma -- ri -- a, San -- cta Ma -- %005
  ri -- a, suc -- cur -- re mi- _ _ _ _  _ _ _ _  _ _ %010
}
staffTwoNotes =  \relative c' {
      %\clef "G_8"
      g2 c2. d4 a2 | g4. a8 b8[ c8] d2 cs4 d2 | r4 d2 d4 |  %005
      e2 f2 | d2 r2 | c2 f2. d4 f2 | e2 d4. c8 | %010
}
staffTwoWords = \lyricmode {
  San -- cta Ma -- ri -- _ _ _ _ _   _ a, San -- cta %05
  Ma -- ri -- a, suc -- cur -- re mi -- se- _ _  %10
}


#(set-global-staff-size 18)

\header {
  title = "Sancta Maria, succurre miseris"
  composer = "Philippe Verdelot"
  tagline = ""
}


\score {
  \new StaffGroup
  <<
    \new Staff
    <<
      \set Staff.instrumentName = #"Superius "
      \new Voice = "staffOne" { \addKey \staffOneNotes }
      \lyricsto "staffOne" \new Lyrics \staffOneWords
      \barSetup
    >>
    \new Staff
    <<
      \set Staff.instrumentName = #"Contratenor "
      \new Voice = "staffTwo" { \addKey \staffTwoNotes }
      \lyricsto "staffTwo" \new Lyrics \staffTwoWords
      \barSetup
    >>
  >>

  \layout
  {
    indent = 6\cm
    \hide Score.SystemStartBracket
    \override Score.BarNumber.font-size = #1.5
    \override Score.BarNumber.break-visibility = #end-of-line-invisible
    \override Score.BarNumber.self-alignment-X = #LEFT
    \set Score.barNumberVisibility = #(every-nth-bar-number-visible 5)
    \override Staff.InstrumentName.self-alignment-X = #RIGHT    

    \context { \Voice \remove "Forbid_line_break_engraver" }
    %#(layout-set-staff-size 18)
  }
  %\midi { }
}
Reply | Threaded
Open this post in threaded view
|

Re: Learning Lilypond, comments invited - part 2

Noeck
> Can the property "forbid_line_break_engraver" also be accessed using a dot
> notation?

I am not the only one ;) (David will understand what I want to say)

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Learning Lilypond, comments invited - part 2

David Kastrup
In reply to this post by Colin Tennyson
Colin Tennyson <[hidden email]> writes:

> I'm creating a new thread because the previous one has become somewhat
> cluttered.
>
> My template is much better now, thank you for your suggestions.
>
> As emphasized by David Kastrup, the keyword \new instructs Lilypond to
> create a new instance of a class.
> \new StaffGroup creates an instance of the StaffGroup object.

When you blindly exchange words and terms to the names of concepts of
which you have an understanding, that does not mean that stuff will
magically start behaving according to those concepts.  And it does not
facilitate communication.

> In this template several properties of the Score class are modified, such
> as:    
> \hide Score.SystemStartBracket
> \override Score.BarNumber.font-size = #1.5
>
> I surmise that the StaffGroup object inherits from the Score object,
> similar to inheritence in object oriented programming.

See, now you've muddled up your terminology to a degree where it does
not make any sense.

You call contexts "objects", but those don't inherit anything, and most
certainly not in the sense of object oriented programming.  In OOP, you
have a _type_ hierarchy based on inheritance.

However, the parent relationship of contexts is not a type hierarchy:
every context is created from its context description and _nothing_
else.

The parent relationship comes into play if we are looking at
_properties_: when looking up a property (context/grob), looking up in
some context a property that is not defined will instead get looked up
in the parent context.

The parent relationship is only established when a context is created.
While some guidelines are in the context definition (namely the types of
subcontexts that would be acceptable, and a default type to create and
delegate the subcontext creation to in case a context of the given type
can' be found or created otherwise).

> One thing remains: the property "forbid_line_break_engraver" is a property
> of the element Voice

No, it isn't.  Your use of "property" and "element" does not make any
sense.

> If possible I want to avoid repeating commands. I don't want to put in the
> \remove "forbid_line_break_engraver" four times, for every voice in the
> score.

So do it in the layout definition.

> For the other properties I was able to use a dot notation access. Examples:
> \hide Score.SystemStartBracket
> \override Staff.InstrumentName.self-alignment-X = #RIGHT    
>
> The accessor \context allows the property to be set centrally:
> \context { \Voice \remove "Forbid_line_break_engraver" }

Again, you are wildly throwing terms around that have no sensible
relation or meaning.  \context is no "accessor".  It is a reserved word
that will, inside of a layout definition, start a context definition.

> But is just a side effect? Is \context meant for something else entirely?
> Can the property "forbid_line_break_engraver" also be accessed using a dot
> notation?

I don't understand what you are trying to talk about.

--
David Kastrup

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Learning Lilypond, comments invited - part 2

Kieren MacMillan
Hi Colin,

I will try to answer in a way that helps you.

> the keyword \new instructs Lilypond to create a new instance of a class.

You clearly come from a programming background, which will help you scale the Lilypond learning curve in some ways.
However, don’t push that analogy too far, or you might find (as I did) that it can confuse matters.  =)

> \new StaffGroup creates an instance of the StaffGroup object.

In the way you’re thinking, \new StaffGroup does indeed “create” a new context ("instance of an object”) which matches the StaffGroup definition.

> I surmise that the StaffGroup object inherits from the Score object, similar to inheritence in object oriented programming.

Here, David does [with my judicious editing ;)] do a good job of explaining the situation:

> the parent relationship of contexts is not a type hierarchy:
> every context is created from its context description […]
> the parent relationship comes into play if we are looking at _properties_:
> when looking up a property (context/grob), looking up in some context
> a property that is not defined will instead get looked up
> in the parent context.
>
> The parent relationship is only established when a context is created.
> While some guidelines are in the context definition (namely the types of
> subcontexts that would be acceptable, and a default type to create and
> delegate the subcontext creation to in case a context of the given type
> can' be found or created otherwise).

Is anything in there unclear?

> the property "forbid_line_break_engraver" is a property of the element Voice

More accurately, the Voice context, as defined by default, includes the forbid_line_break_engraver.

> If possible I want to avoid repeating commands. I don't want to put in the
> \remove "forbid_line_break_engraver" four times, for every voice in the score.

Correct — you can simply “redefine” or “extend” the definition of voice:

\layout {
  \context {
    \Voice
    \remove "forbid_line_break_engraver"
  }
}

Now, in any scores which use that layout definition, \new Voice [or \context Voice] will give you a Voice context [“instance”] which does not include the forbid_line_break_engraver.

> The accessor \context allows the property to be set centrally:
> \context { \Voice \remove "Forbid_line_break_engraver” }

The **reserved word** \context can indeed be used to add or remove an engraver in an abstracted (“central”) way.

> But is just a side effect? Is \context meant for something else entirely?

To the user’s eye, \context does two different things when used in two different places:
1. Inside a \layout definition, it starts the definition of a context.
2. Inside a score, it will look for an existing “instance” (by name) and create a new one (if not found).

Perhaps this is what you’re referring to?

> Can the property "forbid_line_break_engraver" also be accessed using a dot notation?

Not that I’m aware of: engravers can only be added (\consists) or removed (\remove) in a context definition.
There is no mechanism (e.g.) “Voice.forbid_line_break_engraver.foo”.

Hope this helps!
Kieren.
_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Learning Lilypond, comments invited - part 2

David Kastrup
Kieren MacMillan <[hidden email]> writes:

>> Can the property "forbid_line_break_engraver" also be accessed using
>> a dot notation?
>
> Not that I’m aware of: engravers can only be added (\consists) or
> removed (\remove) in a context definition.

No, they can also be added or removed in a context _modification_, as in

\new Voice \with { \remove "..." \consists "..." }
  { ... }

The presence/absence of engravers is established when a context is
created and is static over its lifetime, or iteration would not be able
to work consistently.

Dot syntax is used for navigating to an existing (or implicitly created)
context during music execution.  So it's not useful with engravers.

That dot syntax is reinterpreted in the context of _music_ expressions
in a layout definition to affect a subset of context definitions is just
a courtesy
<URL:http://code.google.com/p/lilypond/issues/detail?id=2358>.  As
opposed to inside of context definitions and modifications,
\override/\revert are not specifically supported in the syntax of layout
definitions.  They just happen to be music expressions that can be
sensibly reinterpreted.  That would not work for engravers.

--
David Kastrup

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Learning Lilypond, comments invited - part 2

Kieren MacMillan
Hi David,

> No, they can also be added or removed in a context _modification_, as in
>
> \new Voice \with { \remove "..." \consists "..." }
>  { … }

Thank you for the clarification/correction: engravers can be added or removed in a context definition or modification.

Cheers,
Kieren.
_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Learning Lilypond, comments invited - part 2

Colin Tennyson
In reply to this post by Kieren MacMillan
Kieren MacMillan wrote
You clearly come from a programming background, which will help you scale the Lilypond learning curve in some ways.
However, don’t push that analogy too far, or you might find (as I did) that it can confuse matters.  =)

Hi Kieren,

To use another analogy: our choir conductor sometimes asks in mild exasparation: "Sing _something_  , never mind you're not sure. If you sing the wrong note I can correct it, but if you don't sing at all I'm dead in the water."

So, in asking questions here on this forum I allow myself to err on the side of pushing.

(I'm not a programmer, but as you can tell from the terminology I picked up I have been reading up on general principles of programming.)


In order to learn the LilyPond environment, I feel I need to know the concepts that have guided how Lilypond is implemented.

The opportunity for parent-child relationships is obvious.
Systems consist of staffs, staffs are filled with notes.
So, is all the typesetting organized according to parent-child and sibling-group relationships, or only some things and other things not?


Why do I see side by side two keywords for setting properties: \set and \override.

I have seen environments where every property that is by nature ON/OFF is controlled with a boolean variable. That is straightforward, that helps to make the enviroment learnable.

Why do I see side by side several ways of toggling ON/OFF?
I see "\hide"  "\undo \hide"
I see "consists" "\remove"
I see "##t" and  "##f"

I wonder, how did the development of LilyPond end up with the syntax and keyword set that it now has?
Reply | Threaded
Open this post in threaded view
|

Re: Learning Lilypond, comments invited - part 2

David Kastrup
Colin Tennyson <[hidden email]> writes:

> To use another analogy: our choir conductor sometimes asks in mild
> exasparation: "Sing _something_  , never mind you're not sure. If you sing
> the wrong note I can correct it, but if you don't sing at all I'm dead in
> the water."
>
> So, in asking questions here on this forum I allow myself to err on the side
> of pushing.
>
> (I'm not a programmer, but as you can tell from the terminology I picked up
> I have been reading up on general principles of programming.)
>
>
> In order to learn the LilyPond environment, I feel I need to know the
> concepts that have guided how Lilypond is implemented.

Contexts, properties and engravers are described in the Usage manual.
Be sure to read the latest version as there have been quite a few
improvements.

> Why do I see side by side two keywords for setting properties: \set
> and \override.

That is explained in the manual.

> I have seen environments where every property that is by nature ON/OFF is
> controlled with a boolean variable. That is straightforward, that helps to
> make the enviroment learnable.
>
> Why do I see side by side several ways of toggling ON/OFF?
> I see "\hide"  "\undo \hide"

If you prefer, you can override the transparency property of a grob with
#t and #f.  \hide is just a convenience function.

> I see "consists" "\remove"
> I see "##t" and  "##f"
>
> I wonder, how did the development of LilyPond end up with the syntax and
> keyword set that it now has?

The change log files are available, and so are the archives of the
developer and user lists.

--
David Kastrup

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Learning Lilypond, comments invited - part 2

Noeck

>> Why do I see side by side two keywords for setting properties: \set
>> and \override.
>
> That is explained in the manual.

With the promising caption "\set versus \override" and no content:
http://www.lilypond.org/doc/v2.18/Documentation/notation/set-versus-override

The preceding sections are helpful though.

Joram

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Learning Lilypond, comments invited - part 2

David Kastrup
Noeck <[hidden email]> writes:

>>> Why do I see side by side two keywords for setting properties: \set
>>> and \override.
>>
>> That is explained in the manual.
>
> With the promising caption "\set versus \override" and no content:
> http://www.lilypond.org/doc/v2.18/Documentation/notation/set-versus-override

Having spent quite a bit of time writing this section and making it as
accurate as I can, I consider the sweeping characterization as "no
content" rather impolite.  Please try offering more constructive
criticism.

It has been on review as
<URL:http://code.google.com/p/lilypond/issues/detail?id=3649>.

--
David Kastrup

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Learning Lilypond, comments invited - part 2

Marc Hohl
Am 03.01.2014 19:20, schrieb David Kastrup:

> Noeck <[hidden email]> writes:
>
>>>> Why do I see side by side two keywords for setting properties: \set
>>>> and \override.
>>>
>>> That is explained in the manual.
>>
>> With the promising caption "\set versus \override" and no content:
>> http://www.lilypond.org/doc/v2.18/Documentation/notation/set-versus-override
>
> Having spent quite a bit of time writing this section and making it as
> accurate as I can, I consider the sweeping characterization as "no
> content" rather impolite.  Please try offering more constructive
> criticism.
>
Well, clicking at the link above loads a page with a caption only and no
content, at least in the german version.

Marc

> It has been on review as
> <URL:http://code.google.com/p/lilypond/issues/detail?id=3649>.
>


_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Learning Lilypond, comments invited - part 2

Noeck
In reply to this post by David Kastrup


Am 03.01.2014 19:20, schrieb David Kastrup:

> Noeck <[hidden email]> writes:
>
>>>> Why do I see side by side two keywords for setting properties: \set
>>>> and \override.
>>>
>>> That is explained in the manual.
>>
>> With the promising caption "\set versus \override" and no content:
>> http://www.lilypond.org/doc/v2.18/Documentation/notation/set-versus-override
>
> Having spent quite a bit of time writing this section and making it as
> accurate as I can, I consider the sweeping characterization as "no
> content" rather impolite.  Please try offering more constructive
> criticism.

I didn't want to offend you. For me this page is *really empty*!
With no content I mean literally no content.

Joram

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Learning Lilypond, comments invited - part 2

Noeck
In reply to this post by David Kastrup
Hi David and Phil,

I now realize that this is an issue with the translation. My browser
redirects me automatically to the German version:

http://www.lilypond.org/doc/v2.18/Documentation/notation/set-versus-override.de.html

I now see that the English version of that page indeed has content that
I will read now.

Sorry for the misunderstanding!
Joram



_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Learning Lilypond, comments invited - part 2

David Kastrup
In reply to this post by Marc Hohl
Marc Hohl <[hidden email]> writes:

> Am 03.01.2014 19:20, schrieb David Kastrup:
>> Noeck <[hidden email]> writes:
>>
>>>>> Why do I see side by side two keywords for setting properties: \set
>>>>> and \override.
>>>>
>>>> That is explained in the manual.
>>>
>>> With the promising caption "\set versus \override" and no content:
>>> http://www.lilypond.org/doc/v2.18/Documentation/notation/set-versus-override
>>
>> Having spent quite a bit of time writing this section and making it as
>> accurate as I can, I consider the sweeping characterization as "no
>> content" rather impolite.  Please try offering more constructive
>> criticism.
>>
> Well, clicking at the link above loads a page with a caption only and
> no content, at least in the german version.

The German translation is probably at least a year behind, some parts
more.  The translations that seem to have kept up with 2.18 reasonably
well are the Spanish, Italian and French translations, probably in that
order.

--
David Kastrup

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Learning Lilypond, comments invited - part 2

Phil Holmes
In reply to this post by Noeck
----- Original Message -----
From: "Noeck" <[hidden email]>
To: "David Kastrup" <[hidden email]>; <[hidden email]>
Cc: <[hidden email]>
Sent: Friday, January 03, 2014 6:30 PM
Subject: Re: Learning Lilypond, comments invited - part 2


> Hi David and Phil,
>
> I now realize that this is an issue with the translation. My browser
> redirects me automatically to the German version:
>
> http://www.lilypond.org/doc/v2.18/Documentation/notation/set-versus-override.de.html
>
> I now see that the English version of that page indeed has content that
> I will read now.
>
> Sorry for the misunderstanding!
> Joram


If you're a native German speaker and want to contribute to LilyPond
development, you could help by translating pages like this.

--
Phil Holmes


_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Learning Lilypond, comments invited - part 2

Simon Bailey-5
In reply to this post by David Kastrup
hi,


On Fri, Jan 3, 2014 at 7:20 PM, David Kastrup <[hidden email]> wrote:
Noeck <[hidden email]> writes:
> With the promising caption "\set versus \override" and no content:
> http://www.lilypond.org/doc/v2.18/Documentation/notation/set-versus-override

Having spent quite a bit of time writing this section and making it as
accurate as I can, I consider the sweeping characterization as "no
content" rather impolite.  Please try offering more constructive
criticism.

Wow. that is extremely detailed. And made me totally space out while reading it -- and I think I have a good grasp of lilypond. Not sure how well that information would help a mildly experienced beginner. Extremely correct documentation is great, don't get me wrong, but I think juggling the paragraphs around on this page may make it more easily digested:

Might I suggest moving the 2nd to last paragraph to the beginning of that section? Or at the latest as a 2nd paragraph? For me, that's the most important piece of information on that page -- \set applies to Contexts and \override to Grobs. Armed with that bit of info, the rest of the text jumps into place.

Regards,
sb

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user