Thank you David for your help. I think the behaviour of "\relative" and
"\resetRelativeOctave" are clear. If the latter is not deprecated IMHO
there are cases where it can be very useful. That one you mention
(preventing up
and down octave when changing code) it is just one. For instance, suppose I
start to write a score and I write this musical phrase:

c4 d8 e8 f4


Later I want to use this phrase again, so I copy and paste so that I have
something like this:

c4 d8 e8 f4
%some notes here
%some notes here
c4 d8 e8 f4  % the octave here depends on the last previous note


As I written in the remark, the octave at the end depends on the last
previous note. You could need to change c4 for example in c'4 to obtain the
same behavior as the first phrase. Suppose you do change it, so that you
obtain:

c4 d8 e8 f4
%some notes here
%some notes here
*c'4* d8 e8 f4  % the octave here depends on the last previous note

now the the phrase at the beginning and at then end stops to match and
became differents. This prevent you from easily create a variable and write
the code in the following (nice) way:

fragment = {c4 d8 e8 f4}

{

\fragment
%some notes here
%some notes here

\fragment
}


On the other hand if you write the the beginning of your musical phrases
always prefixing them with \resetRelativeOctave c' like this:


\resetRelativeOctave c' c4 d8 e8 f4

%some notes here

%some notes here

\resetRelativeOctave c' c4 d8 e8 f4


you don't need to worry in case of copy and paste. (And by the way the fact
you see \resetRelativeOctave make you remind you need to think about the
octave.)

In this latter case if you decide to create a variable to reuse your code
you can do three different things:

1) fragment = {c4 d8 e8 f4}

2) fragment = {\resetRelativeOctave  c' c4 d8 e8 f4}

3) fragment = \relative c' {c4 d8 e8 f4}


The first is useful when you need to be able to do not fix the octave. The
following is an example:

fragment = {c4 d8 e8 f4}

{
\resetRelativeOctave c' \fragment
%some notes here
%some notes here
\resetRelativeOctave c, \fragment
}

The second and the third are useful when the fragment in your score occurs
always at the same octave. But the former makes the notes following the
fragment be at the same octave of the (last note) of the fragment while the
latter makes the note following the fragment be at the same octave of the
(last note) preceding the segment.

Is this correct?
_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to