[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Note duration line (contemporary)
From: |
Thomas Morley |
Subject: |
Re: Note duration line (contemporary) |
Date: |
Fri, 7 Dec 2012 00:25:05 +0100 |
2012/11/29 Jeffrey Trevino <address@hidden>:
> Thanks, Harm! That does just what we were trying to get at, I think.
Hi Jeff,
I put a bit more work on it.
- Changing the used property from 'after-line-breaking to 'stencil,
freeing 'after-line-breaking for other use.
- Fiddling the appearence depending on the occurance of ledgers or not.
- Creating a function to change the thickness of the line. (There is a
greater difference depending on the used version)
- For the line I changed to ly:round-filled-box and added a little blot.
and several minor changes.
\version "2.16.1"
%% Works with 2.17.6
#(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) (if (eq? (grob-name x) 'NoteHead) #t #f)))
(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-property! grob 'stencil new-stencil)
(ly:grob-set-nested-property! grob '(right-bound-info Y) left-Y))))
flatGlissOn =
#(define-music-function (parser location val)(number?)
#{
\override Glissando #'stencil = #(flat-gliss val)
\override Glissando #'breakable = ##t
#})
one = \relative c' {
b1 \glissando
%% Works, because a spacer-rest doesn't define a NoteColumn
s1*9
\once \hideNotes
b1
%% To show a short part of the glissando after linebreak uncomment:
%\override Glissando #'after-line-breaking = ##t
<e' d>1\glissando
\break
s1*8
\break
<e d>
}
two = \relative c' {
s1
f1*3 \glissando
s1*4
\once \hideNotes
b1
}
three = \relative c' {
s1*2
d'1*2 \glissando
s1*3
\once \hideNotes
d1
}
four = \relative c' {
s1*3
%% To show a short part of the glissando after linebreak uncomment:
% \override Glissando #'after-line-breaking = ##t
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!
\flatGlissOn #0.23
\override NoteHead #'duration-log = #2
\override Stem #'stencil = ##f
}
\context {
\Staff
\remove "Time_signature_engraver"
}
\context {
\Score
defaultBarType = #"empty"
}
}
}
Regards,
Harm
flat-gliss.png
Description: PNG image
- Re: Note duration line (contemporary),
Thomas Morley <=