> ------- Original Message ------- > From: "Anthony W. Youngman" <lilyp...@thewolery.demon.co.uk> > To: lilypond-user@gnu.org > Sent: 15.5.09, 18:03:43 > Subject: Re: relative mode occasionally gets forgotten? > > In message <20090515145035.ga3...@nagi>, Graham Percival > <gra...@percival-music.ca> writes > >On Fri, May 15, 2009 at 06:46:39AM -0600, Carl D. Sorensen wrote: > >> > >> First, I think that the information above should be put into 1.1.1 Writing > >> Pitches as examples under Relative octave entry. There should be three > >> separate items/examples: > >> > >> When relative blocks are nested, the innermost relative block applies. > >> > >> \relative c' { d e f \relative c'' { d e f}} > > > >Woah, that's froody! I would have never expected that! > > > >> Note: I haven't tested any of these examples. > > > >I tested the above, because I just couldn't believe it. Anyway, I > >agree with these proposals. > > > When I first saw Chip's example, my reaction was "why on earth would you > want to do that?" > > As I understand it, \relative converts from note names to absolute > pitches. Pretty much everything else in lily works on pitches. In a .ly > file you don't know, on seeing a "c", which c it is - middle, top, low, > whatever. If it's wrapped in a \relative{}, that assigns a pitch to it. > Anything else on seeing it assumes it's "c in the bass clef" as that's > the pitch assigned to the note "c". > > So, I don't know how to word it, but when you're talking about \relative > in the manual it should say that you should only use \relative > immediately around your note names because it converts note names to > absolute pitches. If there's another operator inside your \relative (ie > in Chip's case, a \transpose, in the example above an inner \relative) > that forces absolute pitches, then the \relative will do nothing because > it doesn't know what to do with a pitch. > > Cheers, > Wol > -- > Anthony W. Youngman - anth...@thewolery.demon.co.uk >
I don't know if it's worth mentioning, but you can also run into problems using \repeat inside a \relative block if an \unfoldRepeats is used outside the block. For example in Tune = \relative c' { \partial 4 d4 | \repeat volta 2 { c4 d e g | } } the first c will be relative to the last g on the second play through using \unfoldRepeats. Rewriting as Tune = { \partial 4 d'4 | \repeat volta 2 \relative c' { c4 d e g | } } resolves the problem. I try to make sure I keep \relatives at the innermost block for this reason. Is this a case of programming style, and should the docs cover it? _______________________________________________ lilypond-user mailing list lilypond-user@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-user