bug-lilypond
[Top][All Lists]
Advanced

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

Re: Why do chords print below staff?


From: Mats Bengtsson
Subject: Re: Why do chords print below staff?
Date: Fri, 20 May 2005 10:25:11 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050511



Erik Sandberg wrote:
On Wednesday 18 May 2005 17.45, Mats Bengtsson wrote:

Tricky one! I send a copy to bug-lilypond, both since the
difference between \chords and \chordmode is completely undocumented
(except for the NEWS file for 2.4) and since I don't realize why
the chords end up below the stave.


I stripped down your example to the following, where the chords
still are printed below the staff.

\version "2.4.0"

melody = \relative c'' {
  a4 a8 a g4 g |
  f2 f |
}

guitar = \new ChordNames \chordmode {
  f2 c |
  f1 |
}

\score {
  <<
  \new ChordNames {
\set chordChanges = ##t
\guitar
 }

  \new Staff \context Voice = mel {
\melody
}

}


Note that I replaced '\chords' with '\new ChordNames \chordmode'
(which is equivalent) in an attempt to understand what's going on.

The chords will move up above the stave if you do at least one of
the following:

- Replace 'guitar = \new ChordNames \chordmode' with
  'guitar = \chordmode'

- Move the property setting of chordChanges into
  guitar = \new ChordNames \chordmode {...}

   /Mats


If you expand the guitar variable, you might see what's going on:

\score {
  <<
    \new ChordNames {
      \set chordChanges = ##t
      \new ChordNames \chordmode {
        f2 c |
        f1 |
      }
    }

    \new Staff \context Voice = mel {
      \melody
    }
  >>
}

The second '\new ChordNames' will create a _new_ ChordNames context. The \set chordChanges=##t command will only be effective in the context from the _first_ \new ChordNames (which will contain no notes).

Of course, but your explanation does not say why the second ChordNames
context appears below the Staff context. However, Han-Wen provided the
missing piece of information, namely that the inner ChordNames context
is treated as if it was created "after" the Staff context.
So, the intuitive notion that contexts are ordered in the order they
appear in the score is actually very tricky. The rules I have seen
so far are:
A) If two contexts are created at different (time) locations in the
   piece, then the one created first is processed first.
B) If two contexts are created at the same time location, then the
   one that is created first within \score{...} (when reading from
   top to bottom) is processed first.
C) When interpreting rule A), Property settings within a context are
   considered to happen after the creation of the score but before the
   first note of the piece.
In mathematical terms, these rules clearly define a partial order.
However, it's not clear to me if they also define a complete order
or if there's some more tricky special case to be considered.
Thanks to Han-Wen who hinted to rule C), which I learnt today.

  /Mats





reply via email to

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