Re: temporary polyphonic passage

2025-02-25 Thread David Wright
On Tue 25 Feb 2025 at 13:41:58 (+0100), Gianmaria Lari wrote:

> The implicit instantiation of items is something almost always creating
> problems for me. I agree that without it, the code would be very verbose
> even for very simple situations but in the end, I have the impression that
> it does more harm than good.

Presumably you don't write your scores without instantiating staves
and voices, so we're only talking about examples, particularly MWEs,
here.

I don't see anything wrong with implicit instantiation UNLESS the
problem involves the very same thing. Your MWEs here were a great
lesson in how LP /instantiation/ behaves, but not so good for
getting your notes printed the way you want them.

I think it would be appropriate to add a warning to the list on:
  https://lilypond.org/tiny-examples.html
that would complement the first two reproduced here:

  • Avoid using complicated notes, keys or time signatures,
/unless/ the bug is about the behavior of those items.

  • Do not use \override or \set commands
/unless/ the bug is about those specific commands.

  • Avoid implicit instantiation of staves and voices
/whenever/ your example involves those very same contexts.

> Is there any way to see how the implicit code is converted? I tried with
> \displayLilyMusic but it was not that

Above my paygrade. For example, anything /I/ would put between the {
and << is likely to cause an instantiation event, ie, the Observer
Effect.

However, I would point out that, eg, writing a2 c' at the start,
and d4 d' at the end, of your example gives you more information
than a1 and d4 does, because stem direction is your main diagnostic.

BTW, general advice is to always surround braces by whitespace. It's
one of those things that doesn't usually matter, until it does.

Cheers,
David.



Re: temporary polyphonic passage

2025-02-25 Thread Gianmaria Lari
>
>
> > *If* I understood correctly, if I instantiate the first voice as you
> propose the voice will go in a different context then 'd4'.
>
> That's the contrary. If you instantiate the first Voice (directly after
> the \new Staff command, not after <<, maybe I was not clear enough in my
> previous message) []
>

Here's the problem. I thought you meant to instantiate the item after the
<< !!
Now it's clear Xavier, thanks!!

* * *

The implicit instantiation of items is something almost always creating
problems for me. I agree that without it, the code would be very verbose
even for very simple situations but in the end, I have the impression that
it does more harm than good.

Is there any way to see how the implicit code is converted? I tried with
\displayLilyMusic but it was not that

Thanks!!!
g.


Re: temporary polyphonic passage

2025-02-25 Thread Xavier Scheuer
On Tue, 25 Feb 2025 at 12:48, Gianmaria Lari 
wrote:
>
> *If* I understood correctly, if I instantiate the first voice as you
propose the voice will go in a different context then 'd4'.

That's the contrary. If you instantiate the first Voice (directly after the
\new Staff command, not after <<, maybe I was not clear enough in my
previous message) the d4 would "return" to this Voice (so with \voiceTwo
still active).

> And why does adding the "a1" note at the beginning change the "d4"
engraving at the end?

The a1 at the beginning is instantiating the voice for you.
This is how I understand it.

This is the main reason why I (try to) explicitly instantiate all the
voices and do not use \addlyrics for instance.
To avoid bad surprises with Lily's assumptions.

Kind regards,
Xavier


Re: temporary polyphonic passage

2025-02-25 Thread Gianmaria Lari
[...]

> You are not explicitly instantiating the first voice.
> Replace \new Staff by \new Staff \new Voice and you have the expected
> output.
>

*If* I understood correctly, if I instantiate the first voice as you
propose the voice will go in a different context then 'd4'. This can be ok
or not depending on what you want to do. That's the reason (if I understood
correctly) why in the lilypond online manual they do not instantiate the
first voice.

And why does adding the "a1" note at the beginning change the "d4"
engraving at the end?

Thanks, g.


Re: temporary polyphonic passage

2025-02-25 Thread Xavier Scheuer
On Tue, 25 Feb 2025 at 11:14, Gianmaria Lari 
wrote:
>
> I did some tests and I discovered something that's not clear.
>
> Why in the following code the very last note `d4` stem is up?
>
> %%%
> \version "2.25.23"
> \fixed c' \new Staff
> {
>   %a1
>   <<
> {\voiceTwo a,4 d g c' }
> \new Voice {\voiceOne r1 }
>   >>
>   d4 % stem up
> }
> %%%
>
>
> I didn't call \oneVoice so I was expecting 'd4' would continue the
\voiceTwo and then have its stem direction down.
> Things work as expected if I uncomment the note a1 before the polyphony.
>
> Any suggestions?

Hello,

You are not explicitly instantiating the first voice.
Replace \new Staff by \new Staff \new Voice and you have the expected
output.

Kind regards,
Xavier


Re: temporary polyphonic passage

2025-02-25 Thread Gianmaria Lari
I did some tests and I discovered something that's not clear.

Why in the following code the very last note `d4` stem is up?

%%%
\version "2.25.23"
\fixed c' \new Staff
{
  %a1
  <<
{\voiceTwo a,4 d g c' }
\new Voice {\voiceOne r1 }
  >>
  d4 % stem up
}
%%%


I didn't call \oneVoice so I was expecting 'd4' would continue the
\voiceTwo and then have its stem direction down.
Things work as expected if I uncomment the note a1 before the polyphony.

Any suggestions?
Thanks, g.

On Mon, 24 Feb 2025 at 21:32, Gianmaria Lari 
wrote:

> oh! Great! Grazie Knute, very clear!!! Thanks!!!
>
> On Mon, 24 Feb 2025 at 19:29, Knute Snortum  wrote:
>
>> On Mon, Feb 24, 2025 at 8:39 AM Gianmaria Lari 
>> wrote:
>>
>>> Thanks Knute, very clear example. And thanks David also for your reply.
>>>
>>> What's about \oneVoice? In my examples adding or removing it doesn't
>>> change the output.
>>>

 > >> \fixed c' \new Staff
 > >> {
 > >>   \incipit
 > >>   <<
 > >> {\voiceOne \voiceB}
 > >> \new Voice {\voiceTwo \voiceA}
 > >>   >>
 > >>   \conclusion
 > >> }
 > >>
 > >> %%%
 > >>
 > >> The output is exactly the same but I'm wondering if there are
 > >> substantial differences I should be aware of.
 > >
 > In the second form, the incipit, voiceB, and the conclusion are all
 in the
 > same context.  That means that the conclusion will be in \voiceOne.
 This
 > can be useful if you want to, for instance, slur from the incipit to
 > voiceB, or from voiceB to the conclusion.

>>>
>> Change this:
>>
>> conclusion = {c'4 4 4 4}
>>
>> ...and you'll see the difference.  The main context has been changed to
>> \voiceOne, so if you want \oneVoice again, you have to explicitly set it.
>>
>> --
>> Knute Snortum
>>
>>


Re: temporary polyphonic passage

2025-02-24 Thread Knute Snortum
On Mon, Feb 24, 2025 at 8:39 AM Gianmaria Lari 
wrote:

> Thanks Knute, very clear example. And thanks David also for your reply.
>
> What's about \oneVoice? In my examples adding or removing it doesn't
> change the output.
>
>>
>> > >> \fixed c' \new Staff
>> > >> {
>> > >>   \incipit
>> > >>   <<
>> > >> {\voiceOne \voiceB}
>> > >> \new Voice {\voiceTwo \voiceA}
>> > >>   >>
>> > >>   \conclusion
>> > >> }
>> > >>
>> > >> %%%
>> > >>
>> > >> The output is exactly the same but I'm wondering if there are
>> > >> substantial differences I should be aware of.
>> > >
>> > In the second form, the incipit, voiceB, and the conclusion are all in
>> the
>> > same context.  That means that the conclusion will be in \voiceOne.
>> This
>> > can be useful if you want to, for instance, slur from the incipit to
>> > voiceB, or from voiceB to the conclusion.
>>
>
Change this:

conclusion = {c'4 4 4 4}

...and you'll see the difference.  The main context has been changed to
\voiceOne, so if you want \oneVoice again, you have to explicitly set it.

--
Knute Snortum


Re: temporary polyphonic passage

2025-02-24 Thread Gianmaria Lari
Thanks Knute, very clear example. And thanks David also for your reply.

What's about \oneVoice? In my examples adding or removing it doesn't change
the output.

Thanks, g.

On Mon, 24 Feb 2025 at 17:31, David Wright 
wrote:

> On Mon 24 Feb 2025 at 07:58:19 (-0800), Knute Snortum wrote:
> > > On Mon, 24 Feb 2025 at 16:18, Gianmaria Lari wrote:
>
> > >> When I need to write a temporary polyphonic passage my code looks
> similar
> > >> to this:
>
> > >> \fixed c' \new Staff
> > >> {
> > >>   \incipit %monodic
> > >>   <<
> > >> \new Voice {\voiceOne \voiceB}
> > >> \new Voice {\voiceTwo \voiceA}
> > >>   >>
> > >>   \conclusion
> > >> }
> > >>
> > >> %%%
> > >>
> > >> I just discovered that the lilypond online help propose something
> > >> different:
>
> > >> \fixed c' \new Staff
> > >> {
> > >>   \incipit
> > >>   <<
> > >> {\voiceOne \voiceB}
> > >> \new Voice {\voiceTwo \voiceA}
> > >>   >>
> > >>   \conclusion
> > >> }
> > >>
> > >> %%%
> > >>
> > >> The output is exactly the same but I'm wondering if there are
> > >> substantial differences I should be aware of.
> > >
> > In the second form, the incipit, voiceB, and the conclusion are all in
> the
> > same context.  That means that the conclusion will be in \voiceOne.  This
> > can be useful if you want to, for instance, slur from the incipit to
> > voiceB, or from voiceB to the conclusion.
>
> It also simplifies adding lyrics for the same reason.
>
> Cheers,
> David.
>


Re: temporary polyphonic passage

2025-02-24 Thread David Wright
On Mon 24 Feb 2025 at 07:58:19 (-0800), Knute Snortum wrote:
> > On Mon, 24 Feb 2025 at 16:18, Gianmaria Lari wrote:

> >> When I need to write a temporary polyphonic passage my code looks similar
> >> to this:

> >> \fixed c' \new Staff
> >> {
> >>   \incipit %monodic
> >>   <<
> >> \new Voice {\voiceOne \voiceB}
> >> \new Voice {\voiceTwo \voiceA}
> >>   >>
> >>   \conclusion
> >> }
> >>
> >> %%%
> >>
> >> I just discovered that the lilypond online help propose something
> >> different:

> >> \fixed c' \new Staff
> >> {
> >>   \incipit
> >>   <<
> >> {\voiceOne \voiceB}
> >> \new Voice {\voiceTwo \voiceA}
> >>   >>
> >>   \conclusion
> >> }
> >>
> >> %%%
> >>
> >> The output is exactly the same but I'm wondering if there are
> >> substantial differences I should be aware of.
> >
> In the second form, the incipit, voiceB, and the conclusion are all in the
> same context.  That means that the conclusion will be in \voiceOne.  This
> can be useful if you want to, for instance, slur from the incipit to
> voiceB, or from voiceB to the conclusion.

It also simplifies adding lyrics for the same reason.

Cheers,
David.



Re: temporary polyphonic passage

2025-02-24 Thread Knute Snortum
On Mon, Feb 24, 2025 at 7:23 AM Gianmaria Lari 
wrote:

> Sorry, I also forgot to mention that at the end of my polyphonic passage I
> normally forgot to mention (like I forgot in my previous code) the
> \oneVoice statement. What could happen without it?
>
> On Mon, 24 Feb 2025 at 16:18, Gianmaria Lari 
> wrote:
>
>> When I need to write a temporary polyphonic passage my code looks similar
>> to this:
>>
>> %%%
>>
>> \version "2.25.23"
>>
>> incipit = {c4 4 4 4}
>> conclusion = {c4 4 4 4}
>> voiceA = {c4 d e f}
>> voiceB = {b4 a g f}
>>
>> \fixed c' \new Staff
>> {
>>   \incipit %monodic
>>   <<
>> \new Voice {\voiceOne \voiceB}
>> \new Voice {\voiceTwo \voiceA}
>>   >>
>>   \conclusion
>>
>> }
>>
>> %%%
>>
>> I just discovered that the lilypond online help propose something
>> different:
>>
>> << { \voiceOne … }
>>   \new Voice { \voiceTwo … }
>> >> \oneVoice
>>
>> or, using my previous example:
>>
>> %%%
>>
>> \version "2.25.23"
>>
>> incipit = {c4 4 4 4}
>> conclusion = {c4 4 4 4}
>> voiceA = {c4 d e f}
>> voiceB = {b4 a g f}
>>
>> \fixed c' \new Staff
>> {
>>   \incipit
>>   <<
>> {\voiceOne \voiceB}
>> \new Voice {\voiceTwo \voiceA}
>>   >>
>>   \conclusion
>> }
>>
>> %%%
>>
>> The output is exactly the same but I'm wondering if there are
>> substantial differences I should be aware of.
>> Thanks, g.
>>
>
In the second form, the incipit, voiceB, and the conclusion are all in the
same context.  That means that the conclusion will be in \voiceOne.  This
can be useful if you want to, for instance, slur from the incipit to
voiceB, or from voiceB to the conclusion.  Try:

%%%
incipit = {c4 4 4 4(}
voiceB = {b4) a g f}
%%%

--
Knute Snortum


Re: temporary polyphonic passage

2025-02-24 Thread Gianmaria Lari
Sorry, I also forgot to mention that at the end of my polyphonic passage I
normally forgot to mention (like I forgot in my previous code) the
\oneVoice statement. What could happen without it?

On Mon, 24 Feb 2025 at 16:18, Gianmaria Lari 
wrote:

> When I need to write a temporary polyphonic passage my code looks similar
> to this:
>
> %%%
>
> \version "2.25.23"
>
> incipit = {c4 4 4 4}
> conclusion = {c4 4 4 4}
> voiceA = {c4 d e f}
> voiceB = {b4 a g f}
>
> \fixed c' \new Staff
> {
>   \incipit %monodic
>   <<
> \new Voice {\voiceOne \voiceB}
> \new Voice {\voiceTwo \voiceA}
>   >>
>   \conclusion
>
> }
>
> %%%
>
> I just discovered that the lilypond online help propose something
> different:
>
> << { \voiceOne … }
>   \new Voice { \voiceTwo … }
> >> \oneVoice
>
> or, using my previous example:
>
> %%%
>
> \version "2.25.23"
>
> incipit = {c4 4 4 4}
> conclusion = {c4 4 4 4}
> voiceA = {c4 d e f}
> voiceB = {b4 a g f}
>
> \fixed c' \new Staff
> {
>   \incipit
>   <<
> {\voiceOne \voiceB}
> \new Voice {\voiceTwo \voiceA}
>   >>
>   \conclusion
> }
>
> %%%
>
> The output is exactly the same but I'm wondering if there are
> substantial differences I should be aware of.
> Thanks, g.
>


Re: temporary polyphonic passage in Staff + TabStaff

2014-04-05 Thread Federico Bruni
2014-04-05 22:09 GMT+02:00 Pierre Perol-Schneider <
pierre.schneider.pa...@gmail.com>:

> Hi Federico,
>
>
> 2014-04-05 21:56 GMT+02:00 Federico Bruni :
>
> I'm typesetting a two voice piece which needs a temporary third voice in
>> one bar only.
>> The problem is that I'm using Staff + TabStaff, so the following minimal
>> example creates an extra  staff. Comment the TabStaff block and the problem
>> doesn't exist.
>>
>
> Why not simplify your code :
>
>
> upper = \relative c' {
>
> c1
>
> <<
>
> { c4 d } \\ { g, a }
>
> >>
>
> }
>
> How's that ?
>
>
Hi Pierre

thank you, it's perfect.
It's what was written in the thread I linked to, but somehow I didn't get
it :(
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: temporary polyphonic passage in Staff + TabStaff

2014-04-05 Thread Pierre Perol-Schneider
Hi Federico,


2014-04-05 21:56 GMT+02:00 Federico Bruni :

> I'm typesetting a two voice piece which needs a temporary third voice in
> one bar only.
> The problem is that I'm using Staff + TabStaff, so the following minimal
> example creates an extra  staff. Comment the TabStaff block and the problem
> doesn't exist.
>

Why not simplify your code :

upper = \relative c' {

c1

<<

{ c4 d } \\ { g, a }

>>

}

How's that ?
~Pierre
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user