lilypond-user
[Top][All Lists]
Advanced

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

Re: Spacer Rests Global Confusion


From: David Wright
Subject: Re: Spacer Rests Global Confusion
Date: Thu, 26 Apr 2018 13:00:45 -0500
User-agent: Mutt/1.5.21 (2010-09-15)

On Thu 26 Apr 2018 at 12:20:34 (-0400), R wrote:
> On 4/26/2018 12:13 PM, Simon Albrecht wrote:
> >On 26.04.2018 18:02, R wrote:
> >>When the duration of the called variable is explicitly given,
> >>everything is correct. However, if you remove the duration and
> >>have it default to the normal quarter note, this causes a
> >>problem.
> >
> >If you don’t give an explicit duration to a note, its duration is
> >going to be the last duration previously encountered _in the input
> >file_. This is done by the parser without any consideration about
> >what’s eventually going to be used or how. The ‘default’ of a
> >quarter note is therefore only effective for the very first note
> >in a file.
> >It’s a bad idea to rely on that, anyway. You should really start
> >each variable and likely even each line with an explicit pitch
> >_and_ explicit duration. (In my own use I’m not so strict about
> >_every_ line, but the first line in each variable is a must.)
> >
> >Best, Simon
> 
> Right. I gave several examples but. But it's an uncalled variable.
> Why should it output anything or impact anything that's called? Is
> it only durations that can leak out of uncalled variables? What else
> can impact outside an uncalled variable data?

Several. Pitches (specifically, their octave) can leak if you use
\relative in the way some people do. In your case, each variable has
its own \relative {…} which is good proctice. However, I would have
reservations about then starting each part with a variable, even if
it's \global (which most people would not use for containing pitches).
Tags are another, if they're (ab)used.

It's really a question of "scope" (though LP is *not* a programming
language¹). As you see in your example, LP's idea of the "current
default duration" runs across the entire source, even if you
include another file. So, for example, in

{
  c'2 d'
  \include "file.ily"
  e' f'
}

it's impossible to know the duration of e' without examining the
last duration specified in file.ily.

So good practice is to use \relative {…} to contain only notes
and simple commands, and start each measure (preferably on
separate lines) with a note and duration, as advised above.

¹Don't be fooled by { }. It indicates sequential music, and has
no relationship with, say, braces in C or Perl.

Cheers,
David.



reply via email to

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