lilypond-user
[Top][All Lists]
Advanced

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

Re: Stem objects with symbols stamped on top


From: Lukas-Fabian Moser
Subject: Re: Stem objects with symbols stamped on top
Date: Thu, 15 Apr 2021 16:26:55 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1

Hi Tom,

Am 15.04.21 um 15:44 schrieb Tom Brennan:
Hello

I'm trying to figure out how to temporarily change the stems in a staff so that they appear like the "aeolian" stems displayed at the bottom of this video (which has been queued to the relevant segment): https://youtu.be/9cGJ-Y1EviI?t=57 <https://youtu.be/9cGJ-Y1EviI?t=57>

I've seen how Penderecki tremolos are achieved; is there something like that for Stem objects, perhaps using a list of predefined (or maybe even arbitrary, postscript, etc.) symbols?

Thank you!
Tom

Maybe something like this?

\version "2.22.0"

% Might be replaced by a different drawing!
triangle-up = \markup \general-align #Y #CENTER \center-align {
  \override #'(thickness . 0.1)
  \override #'(font-size . -5)
  \triangle ##f
}

% Test of \triangle-up markup.
\markup { Using triangle symbol which looks like this: \triangle-up }

aeolianOn = \temporary \override Stem.stencil =
#(lambda (grob)
   (let* ((dir (ly:stem::calc-direction grob))
          (triangle-stencil (grob-interpret-markup grob triangle-up))
          (rotated-triangle
           (if (positive? dir)
               (ly:stencil-rotate triangle-stencil 180 0 0)
               triangle-stencil))
          (stem (ly:stem::print grob))
          (stem-extent
           (if (ly:stencil? stem) ; not every note has a non-empty stem!
               (ly:stencil-extent stem Y)
               '(0 . 0)))
          (stem-center (interval-center stem-extent)))
     (ly:stencil-add
      (if (ly:stencil? stem) stem point-stencil)
      (ly:stencil-translate
       rotated-triangle
       ; translate to stem-center "plus something" (1/4)
       ; to avoid one edge of the triangle to melt with staff line
       (cons 0 (+ stem-center (/ dir 4)))))))

aeolieanOff = \undo \aeolianOn

\new Staff \relative {
  c'2 d4 e f a c e, d1
  \aeolianOn
  c2 d4 e f a c e, d1
  \aeolieanOff
}




reply via email to

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