lilypond-user
[Top][All Lists]
Advanced

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

Re: Stem length at a fixed height


From: Thomas Morley
Subject: Re: Stem length at a fixed height
Date: Fri, 6 Mar 2015 00:10:36 +0100

2015-03-05 18:46 GMT+01:00 Pierre Perol-Schneider
<address@hidden>:
> Hi,
>
> In a tablature, full notation, I need to get the stem length at the same
> level as the predefined beam position.
> Today I use a workaround that gives a bunch of warnings:
>
> \version "2.18.2"
>
> myMusic = \transpose c c, {
>   \key ees\major
>   \tag myStaff { ees8 ees16 f f f aes8~ aes4 aes8 g16 f }
>   % => here's a workaround, using brackets, but gives warnings:
>   \tag myTab { ees8 ees16 f f[ f aes8~ aes4 aes8 g16 f] }
> }
>
> \score {
>   \new StaffGroup <<
>     \new Staff \keepWithTag myStaff \myMusic
>     \new TabStaff \keepWithTag myTab \myMusic
>   >>
>   \layout {
>     \context {
>       \Staff
>       \clef "F_8"
>       \numericTimeSignature
>     }
>     \context {
>       \TabStaff
>       stringTunings = #bass-tuning
>       \clef "moderntab"
>       \tabFullNotation
>       \stemDown
>       \override Beam.positions = #'(-3.5 . -3.5)
>       \omit TimeSignature
>       \omit TextScript
>     }
>   }
> }
>
> Has anyone a brilliant idea to fix that ?
>
> TIA,
> Pierre



Hi Pierre,

how about:

\version "2.18.2"

equal-tab-staff-stems =
#(define-music-function (parser location val)(number?)
#{
  \override Stem.direction =
    #(lambda (grob)
      (if (negative? val)
          DOWN
          UP))

  \override Stem.after-line-breaking =
    #(lambda (grob)
      (let* ((stem-begin-position (ly:grob-property grob 'stem-begin-position)))
        ;; the override for Beam.positions counts from staff-position 0
        ;; thus we need to go there for the (unbeamed) stem-length as well
      ;; beam-thickness is taken from engraver-init.ly:
      (ly:grob-set-property! grob
        'length
        (+ (if (negative? val)
               stem-begin-position
               (- stem-begin-position))
           (* (abs val) 2)
           ;; beam-thickness:
           0.32))))

  \override Beam.positions = #(cons val val)
#})

myMusic = \transpose c c, {
  \key ees\major
  ees8 ees16 f f f aes8~ aes4 f c f, aes8 g16 f
}

\score {
  \new StaffGroup <<
    \new Staff \myMusic
    \new TabStaff \myMusic
  >>
  \layout {
    \context {
      \Staff
      \clef "F_8"
      \numericTimeSignature
    }
    \context {
      \TabStaff
        stringTunings = #bass-tuning
        \clef "moderntab"
        \tabFullNotation
        \equal-tab-staff-stems -3.5
        \omit TimeSignature
        \omit TextScript
    }
  }
}


HTH,
  Harm



reply via email to

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