lilypond-user
[Top][All Lists]
Advanced

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

Re: How to work with large orchestral1 projects


From: Thomas Morley
Subject: Re: How to work with large orchestral1 projects
Date: Mon, 22 Feb 2016 00:42:04 +0100

2016-02-20 22:02 GMT+01:00 Carl-Henrik Buschmann <address@hidden>:
> Hi guys,
>
> I'm trying to learn how to use lilypond to typeset orchestral material.
> Handling large projects is fun but good documentation regarding this is hard
> to come by. I'm still a lilypond novice and my Google-Fu has let me down, I
> need help.
>
> I'm using my own orchestration which i engraved in Sibelius a while back.
>
> This is my original sibelius score i.e.: the "ideal":
> http://i.imgur.com/fIQJN8v.png
>
> And this is my lilypond output so far:
> http://i.imgur.com/g2OL258.png
>

Hi Carl-Henrik,

if you want your score like the Sibelius-output, I'd use Sibelius. ;)
I think trying to trim LilyPond doing the same as Sibelius will make
you miss some LilyPond-features.

That said...
It's not wrong to implement missing features into LilyPond.

Hence I took a look at your request below.

> 3) I want the beams to and from rests, with stemlets, like so:
> http://i.imgur.com/62wXphp.png


Others answered already about the possibilities to get the beam. So I
limited my work to stemlets over rests.

Right now LilyPond offers the possibility to set the length of
stemlets to a certain but fixed value.
Iiuc, you want it flexible, always extending from the beam close to the rest.

Thus my coding below, it's only tested for the given examples, though.
Further testing is your turn.

\version "2.19.36"

#(define stemlet-length-to-rest
;; Always extend stemlets over beamed rests, minimum is 0.5
  (lambda (grob)
    (let* ((stem (ly:grob-object grob 'stem))
           (beam
             (if stem
                 (ly:grob-object stem 'beam)
                 #f)))
      (if (and (not (null? beam)) (not (null? stem)))
          (let* ((sys
                   (ly:grob-system grob))
                 (stems
                   (ly:grob-array->list (ly:grob-object beam 'stems)))
                 (stem-coord
                   (- (ly:grob-relative-coordinate
                        (car (member stem stems)) sys X)
                      (ly:grob-relative-coordinate
                        (car stems) sys X)))
                 (beam-pos
                   (ly:grob-property beam 'positions))
                 (beam-y-length
                   (- (car beam-pos) (cdr beam-pos)))
                 (beam-x-length
                   (let ((x-pos (ly:grob-property beam 'X-positions)))
                     (- (car x-pos) (cdr x-pos))))
                 (stem-add-for-beam-slant
                   (if (or (inf? stem-coord) (zero? stem-coord))
                       0
                       (* (/ beam-y-length beam-x-length)
                          stem-coord)))
                 (beam-dir
                   (ly:grob-property beam 'direction))
                 (staff-space
                   (ly:staff-symbol-staff-space grob))
                 (rest-y-ext
                   (ly:grob-extent grob (ly:grob-parent grob Y) Y)))
            (ly:grob-set-property! stem 'stemlet-length
              (max 0.5
                (+ (* beam-dir stem-add-for-beam-slant)
                   (- (if (= beam-dir DOWN)
                          (- (car rest-y-ext) (car beam-pos))
                          (- (car beam-pos) (cdr rest-y-ext)))
                      (/ staff-space 2))))))))))

stemlets-test =
  \override Rest.after-line-breaking = #stemlet-length-to-rest

m = { r8[ d''\rest r c''8] c''2 \bar "||" }
mus = {
  \time 2/4
  \voiceOne
  \m
  \once \override Beam.positions = #'(5 . 7)
  \m
  \once \override Beam.positions = #'(7 . 5)
  \m
  \voiceTwo
  \m
  \once \override Beam.positions = #'(-5 . -7)
  \m
  \once \override Beam.positions = #'(-7 . -5)
  \m
}

\score {
  \new StaffGroup
    <<
      \new Staff \mus
      \new Staff \mus
    >>
  \layout {
    \stemlets-test
  }
}


Code and png attached as well.


HTH,
  Harm

Attachment: stemlets-over-rests-01.png
Description: PNG image

Attachment: stemlets-over-rests-01.ly
Description: Text Data


reply via email to

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