Oops.  Too slight errors in the previous post's attachment:

61c61
<          c) is downstem
---
>          c) is upstem
76,77c76,78
<     run is a second, and neither note is on the middle line, then
<     move on (no adjustment is needed in this case).
---
>     run is a second, and neither note is in the space below the
>     middle line, then move on (no adjustment is needed in this
>     case).

I've attached a revised version here.
- Mark


      
Stem length algorithm for LilyPond
  (following Ted Ross chapter 3 as closely as possible)

* If an upstem stemmed non-flagged non-beamed note is found on
    1) the middle staff line, or
    2) the space just above the middle staff line, or
    3) the space just below the middle staff line,
  then:
  * look to the left in the current voice on the current staff
    (system) until the first of the following is found:
      1) a rest
      2) any note that:
         a) lacks a stem
         b) is flagged or beamed
         c) is downstem
         d) is more than a third away from the note found just
            before
         e) is below the 2nd staff-line
         f) is above the 4th staff-line
         g) (what about tremolo beams?)
  * if any of the above is found, mark the note found just before
    it as the beginning of the "run".
  * if the beginning of the voice is reached, mark the first note
    of the voice as the beginning of the run.
  * if the beginning of the system is reached, mark the first note
    of the system as the beginning of the run.
  * proceed similarly to find the end of the run on the right
    side.
  * if the interval between the highest and lowest notes of the
    run is a second, and neither note is on the middle line, then
    move on (no adjustment is needed in this case).
  * each of the five staff degrees (from the 2nd line up to the
    4th line) is assigned a minimum and a maximum stem length
    (pitches given as in treble clef, units are staff-degrees):
       g'  min 7, max 7
       a'  min 6, max 7
       b'  min 5, max 6
       c'' min 5, max 6
       d'' min 5, max 5
  * for each run, set the stem length of the lowest pitch to its
    minimum value and set the stem length of the highest pitch to
    its maximum value, and distribute the remaining stem lengths
    evenly, even if some of the inner pitches are not used in the
    music expression.

For a run of downstem notes, the procedure is similar, but all
the relevant staff degrees are shifted down one.  For clarity,
here is the procedure for downstem notes:

* If an downstem stemmed non-flagged non-beamed note is found on
    1) the middle staff line, or
    2) the space just below the middle staff line, or
    3) the line below that
  then:
  * look to the left in the current voice on the current staff
    (system) until the first of the following is found:
      1) a rest
      2) any note that:
         a) lacks a stem
         b) is flagged or beamed
         c) is upstem
         d) is more than a third away from the note found just
            before
         e) is on or below the 1st (lowest) staff-line
         f) is on or above the 4th staff-line
         g) (what about tremolo beams?)
  * if any of the above is found, mark the note found just before
    it as the beginning of the "run".
  * if the beginning of the voice is reached, mark the first note
    of the voice as the beginning of the run.
  * if the beginning of the system is reached, mark the first note
    of the system as the beginning of the run.
  * proceed similarly to find the end of the run on the right
    side.
  * if the interval between the highest and lowest notes of the
    run is a second, and neither note is in the space below the
    middle line, then move on (no adjustment is needed in this
    case).
  * each of the five relevant staff degrees (from the first space
    up to the third space) is assigned a minimum and a maximum
    stem length (pitches given as in treble clef, units are
    staff-degrees):
       f'  min 5, max 5
       g'  min 5, max 6
       a'  min 5, max 6
       b'  min 6, max 7
       c'' min 7, max 7
  * for each run, set the stem length of the lowest pitch to its
    minimum value and set the stem length of the highest pitch to
    its maximum value, and distribute the remaining stem lengths
    evenly, even if some of the inner pitches are not used in the
    music expression.
_______________________________________________
lilypond-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/lilypond-devel

Reply via email to