lilypond-user
[Top][All Lists]
Advanced

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

Re: Duration Line


From: Thomas Morley
Subject: Re: Duration Line
Date: Tue, 11 Mar 2014 02:21:25 +0100




2014-03-05 14:43 GMT+01:00 Nike Hedges <address@hidden>:
I want to write lines which expresse duration of notes.

Like:
埋め込み画像 1
An excerpt from Lachenmann "Dal Niente"

In this piece the lines mean duration of breath sound.
A lot of contemporary pieces use such duration lines.
But I couldn't find any information in LilyPond world so far.

Does anybody know how to write these?

Thanks,
Nike

Hi,

see:
http://lists.gnu.org/archive/html/lilypond-user/2012-12/msg00145.html
In reply to Werner's request I changed the code to the following (maybe you can adept it to your needs):

\version "2.16.0"

%% Works with 2.17.6
%% Works with 2.18.0
%% Works with 2.19.1

#(define (flat-gliss value)
  (lambda (grob)
    (let* ((left-Y (assoc-get 'Y (ly:grob-property grob 'left-bound-info)))
           (stencil (ly:line-spanner::print grob))
           (stencil-x-ext (ly:stencil-extent stencil X))
           (line-thickness (ly:staff-symbol-line-thickness grob))
           (staff-space (ly:staff-symbol-staff-space grob))
           (half-gliss-thick (- (/ staff-space 2) line-thickness))
           (bound-left (ly:spanner-bound grob LEFT))
           (bound-right (ly:spanner-bound grob RIGHT))
           (grob-name (lambda (x) (assq-ref (ly:grob-property x 'meta) 'name)))
           (note-head? (lambda (x) (eq? (grob-name x) 'NoteHead)))
           (staff-pos-left
             (if (note-head? bound-left)
               (ly:grob-property bound-left 'staff-position)
               0))
           (staff-pos-right
             (if (note-head? bound-right)
               (ly:grob-property bound-right 'staff-position)
               0))
           (x-corr (lambda (x) (if (>= (abs x) 6) line-thickness 0)))
           (new-stencil
             (ly:round-filled-box
                (let ((x-corr-left (x-corr staff-pos-left))
                      (x-corr-right (* -4 (x-corr staff-pos-right))))
                 (cons (+ x-corr-left (car stencil-x-ext))
                       (+ x-corr-right
                          (cdr stencil-x-ext)
                          (* line-thickness 3))))
               (interval-widen (cons left-Y left-Y) (- half-gliss-thick value))
               0.1)))

          (ly:grob-set-nested-property! grob '(right-bound-info Y) left-Y)
          new-stencil)))
         
flatGliss =
#(define-music-function (parser location glissando-stubs? val)
  ((boolean? #t) number?)
#{
       
        #(if glissando-stubs?
           #{ \override Glissando #'after-line-breaking = ##t #}
           #{ \revert Glissando #'after-line-breaking #})
        \override Glissando #'stencil = #(flat-gliss val)
        \override Glissando #'breakable = ##t
#})

%%%%%%%%%%%%%%%%%%
%% EXAMPLE
%%%%%%%%%%%%%%%%%%
         
c' {
       
        b1 \glissando
        %% Works, because a spacer-rest doesn't define a NoteColumn
        s1*9
        \once \hideNotes
        b1
        <e' d >1 \glissando
        \break
        s1*8
        \break
        <e d>
}

two = \relative c' {
        s1
        f1 \glissando
        s1*6
        \once \hideNotes
        b1
}

three = \relative c' {
        s1*2
        d'1 \glissando
        s1*4
        \once \hideNotes
        d1
}

four = \relative c' {
        s1*3
        as''1 \glissando
        s1*2 \break
        a!4\glissando
        b \glissando
        c2 \glissando
        s1*2
        \revert Glissando #'stencil
        \override Glissando #'thickness = #3
        d1 \glissando
        s2..
        f,1
}

\score {
        \new Staff
        <<
        \new Voice \one
        \new Voice \two
        \new Voice \three
        \new Voice \four
        >>
        \layout {
                \context {
                        \Voice
                        %% Increasing the number will result
                        %% in a more narrow line.
                        %% Warning: if it is increased > 0.4
                        %% a warning will appear and no line is printed!
                       
                       \flatGliss #0.23
                        \override NoteHead #'duration-log = #2
                        \override Stem #'stencil = ##f
                }
                \context {
                        \Staff
                        \remove "Time_signature_engraver"
                }
                \context {
                        \Score
                        defaultBarType = #"empty"
                }
        }
}


HTH,
  Harm

reply via email to

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