lilypond-devel
[Top][All Lists]
Advanced

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

Re: Documentation error, dynamics and polyphony


From: Mats Bengtsson
Subject: Re: Documentation error, dynamics and polyphony
Date: Wed, 26 Sep 2007 11:04:40 +0200
User-agent: Internet Messaging Program (IMP) H3 (4.0.5)

Quoting Michael Rasmussen <address@hidden>:

On page:
http://lilypond.org/doc/v2.10/Documentation/user/lilypond/Dynamics#Dynamics

It gives a warning and example:

Because these marks are bound to notes, you must use spacer notes if multiple
marks are needed during one note


        c\< c\! d\> e\!
        << f1 { s4 s4\< s4\! \> s4\! } >>

When I implemented something similar I got broken output - the score was rendered
into two staves[1].

There's nothing wrong with the documentation and the example shown in the manual is actually generated using exactly this code (click on the example to see the .ly code).

What happens is that the mechanism in LilyPond to implicitly create
new contexts, is playing you a trick.

Unfortunately, you didn't tell exactly what .ly code you used (it's
always much easier to get relevant response on the mailing list if you
include a small but complete example of .ly code), but I guess your file
looks something like
\version "2.10.0"
\relative c'{
<< f1 { s4 s4\< s4\! \> s4\! } >>
}
The "<<" tells LilyPond that two things should happen in parallel from the top of the score. When LilyPond discovers the "f1", it implicitly creates a Voice context to handle the note and a Staff context to handle the Voice context. Then it comes to the "{ s4 ..." that should happen in parallel to the f1. Again, LilyPond discovers that it needs a Voice context and since things should happen in parallel with what it already has, it creates both a new Voice and a new Staff context, which explains why you get two staves.
(You may argue that this default creation of contexts when the piece starts
with polyphony is non-intuitive, but that's the way LilyPond is implemented).

In the example in the manual, the example starts with a few monophonic
notes, which means that LilyPond has already created a Voice and Staff
context to handle these. When it then comes to the polyphonic section, both lines of music can be handled within the existing Voice context, which means that you don't get the problem.

So, how do you get it all in a single stave, if you want to use this
construct at the top of a piece? Simple - just explicitly create the Voice context:
\version "2.10.0"
\new Voice \relative c'{
<< f1 { s4 s4\< s4\! \> s4\! } >>
}


Checking with the polyphony docs at:
http://lilypond.org/doc/v2.10/Documentation/user/lilypond/Single-staff-polyphony#Single-staff-polyphony

Shows
        << f1 { s4 s4\< s4\! \> s4\! } >>
should be written as
        << { f1 } \\ { s4 s4\< s4\! \> s4\! } >>

No! Please read the next section Explicitly instantiating voices" to learn more about the difference between these two constructs. In fact, the latter construct is wrong, since it forces the stem direction of the note (in case the note had been shorter than a whole note), which isn't desired here.

Indeed this produces the expected, as shown in the example, output.

That's merely a coincidence, since the <<{...} \\ {...} >> creates
two Voice contexts that end up in the same Staff context (don't ask me
to explain the exact details on when a new implicit Staff context is created and when it isn't).

   /Mats





reply via email to

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