lilypond-user
[Top][All Lists]
Advanced

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

Re: Understanding how \tag works in \relative pitched music


From: Guy Stalnaker
Subject: Re: Understanding how \tag works in \relative pitched music
Date: Sat, 5 Aug 2017 13:04:35 -0500
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0

My thanks to all who responded. There were three suggestions offered to "fix" my incorrect code and I confirm that all three produce the expected output.

Guy

On 8/5/2017 10:40 AM, David Wright wrote:
On Fri 04 Aug 2017 at 23:51:49 (-0500), Guy Stalnaker wrote:
So it's an Order of Operations issue.
Unfortunately, your capitalisation indicates you haven't really
understood the implications of what I wrote.

Pitches entered using \relative are
first converted to absolute then the selection using \tag conditional.
But the conversion is effectively a lexical one, and is demonstrated
by the attached which is your example in absolute notation. If the
"\absolute evangelists" were to persuade the maintainers to abolish
\relative, a text editor could be persuaded to do the job. As things
are,   $ ly "rel2abs" -o abs.ly rel.ly
does the job.

Which suggests that \tag used with \relative will never work.
They both work perfectly. The problem is that you thought you
could use \relative to do something semantic. There's a cure.
-When you use \relative, look at the pitches only, and treat the
source in strict lexical order in a single pass.
-When you are designing your \tag structure, imagine that all the
"\relative [optional-pitch]" occurrences have evaporated, leaving
behind just their { } and << >> constructs.

You know, sometimes I think it might have been wiser to go the
whole hog and treat relative/absolute/fixed in the same way
as \language is. The only thing I can see that you lose is their
ability to be nested. I wonder how many people rely on that.

On Aug 4, 2017 10:45 PM, "David Wright" <address@hidden> wrote:

On Fri 04 Aug 2017 at 15:41:34 (-0500), Guy Stalnaker wrote:
All,

Why is this output being created? I would expect to get exactly the same
pitches on all three staffs, but since not, my expectations are obviously
wrong.

%% SNIPPET %%
​straightMusic = \relative c' {
  a2 _\markup { no tag, relative pitch } cis4 e |
  fis1 |
}

clarinetOneMusic = \relative c' {
  \set Score.markFormatter = #format-mark-box-numbers
  \tag #'mark { \mark \default a2 _\markup { tag mark, relative pitch }
cis4 e | }
  \tag #'no-mark { a2 _\markup { tag no-mark, relative pitch } cis4 e | }
  fis1 |
}
Here are the pitches you have entered:

straightMusic = \relative c' { a2 cis4 e fis1 }

clarinetOneMusic = \relative c' { a2 cis4 e a2 cis4 e fis1 }

These pitches are interpreted during _input_ of the source and
become absolute pitches as they are read. They are now absolute
and stay that way.

You have then selected a different set of notes (each with an absolute
pitch) for each staff by using tags, and then transposed them.

In other words, \relative { … } is a one-shot, immediate input process
for making melodic input more convenient (for those of us who like it).

Bear in mind that if \relative { … } contains notes that are already
absolute, eg,
\relative { … \absolute { A } … \transpose { T } … \relative { R } … }
the outer \relative does not reprocess A, T and R because they're
already absolute. (R is processed by the inner \relative first.)
Only the "…" notes are processed by the outer \relative.
Cheers,
David.

-- 
“Happiness is the meaning and the purpose of life, the whole aim and end of human existence.”
― Aristotle

reply via email to

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