lilypond-user
[Top][All Lists]
Advanced

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

Re: Controlling stem lengths in a global way


From: Aaron Hill
Subject: Re: Controlling stem lengths in a global way
Date: Mon, 15 Aug 2022 16:27:49 -0700

On 2022-08-15 4:15 pm, Knute Snortum wrote:
On Mon, Aug 15, 2022 at 4:00 PM Aaron Hill <lilypond@hillvisions.com> wrote:

On 2022-08-15 3:11 pm, Knute Snortum wrote:
> I am engraving a piece where there are many groups of 16th notes where
> the first note is normal size and the rest should look like grace
> notes.  I'm using \scaledDurations, \magnifyMusic and \normalsize to
> do this, but I'm running into a systemic problem: the stems of the
> normal size notes are mostly too short (they'd be fine if they were
> grace notes).  To get around this I'm using beam position overrides
> and tweaks, but this gets tedious quickly.  Is there a) a systemic way
> to tweak the stem lengths, and/or b) better way for me to do this?
>
> %%%
> \version "2.22.2"
> \language "english"
>
> ns = \once \normalsize
>
> % Short stems on the normalsize notes
> \relative d'' {
>   \magnifyMusic #2/3 {
>     \scaleDurations 2/3 {
>       \ns d16 f, g c, f g  \ns c e, g c, e g
>       \ns c d, g c, d g  \ns c e, g c, e g |
>     }
>   }
> }
>
> beamPositionA = \tweak Beam.positions #'(4 . 2) \etc
> beamPositionB = \override Beam.positions = #'(3 . 1)
>
> % Need to tweak or override many, many notes
> \relative d'' {
>   \magnifyMusic #2/3 {
>     \scaleDurations 2/3 {
>       \ns \beamPositionA d16 f, g c, f g  \ns \beamPositionB c e, g c,
> e g
>       \ns c d, g c, d g  \ns c e, g c, e g \revert Beam.positions |
>     }
>   }
> }
> %%%
>
> --
> Knute Snortum

Would \offsetting positions make more sense? For instance, you could do
this:

%%%%
ns = \once {
   \normalsize
   % Stem needs a little bit more length
   % to counteract magnifyMusic...
   \offset positions #'(1 . 0) Beam
}

\relative d'' {
   \magnifyMusic #2/3 {
     \scaleDurations 2/3 {
       \ns d16 f, g c, f g
       \ns c e, g c, e g
       \ns c d, g c, d g
       \ns c e, g c, e g |
     }
   }
}
%%%%

This does assume that the amount of lengthening required is uniform.


-- Aaron Hill

Works like a charm.  Now I can have a couple of variables instead of
dozens.  Thanks!

Another option is to use grob-transformer, which allows for smarter logic such as handling stem direction:

%%%%
ns = \once {
  \normalsize
  \override Beam.positions =
  #(grob-transformer 'positions (lambda (grob orig)
    (let ((dir (ly:grob-property grob 'direction)))
     (cons (+ (car orig) (* dir 0.75)) (cdr orig)))))
}

\relative d'' {
  \magnifyMusic #2/3 {
    \scaleDurations 2/3 {
      %% Some upward stem examples...
      \ns d16 f, g c, f g
      \ns c e, g c, e g
      %% Some downward stem examples...
      \ns f d' c e d c
      \ns g d' b f' d b |
    }
  }
}
%%%%


-- Aaron Hill



reply via email to

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