[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bracket for semitone
From: |
Thomas Morley |
Subject: |
Re: bracket for semitone |
Date: |
Mon, 17 Nov 2014 22:07:50 +0100 |
2014-11-17 21:34 GMT+01:00 Stefan Thomas <address@hidden>:
> Dear community,
> I would like to draw a bracket for a semitone, like You can see it at
>
> http://www.musiklehre.at/Bilder/b0048.gif
>
> How can this be done in lilypond?
Hi,
maybe you can adept this older code:
\version "2.16.2"
#(define ((elbowed-glissando coords) grob)
(define (pair-to-list pair)
(list (car pair) (cdr pair)))
(define (normalize-coords goods x y)
(map
(lambda (coord)
(cons (* x (car coord)) (* y (cdr coord))))
goods))
(define (my-c-p-s points thick)
(make-connected-path-stencil
points
thick
1.0
1.0
#f
#f))
; outer let to trigger suicide
(let ((sten (ly:line-spanner::print grob)))
(if (grob::is-live? grob)
(let* ((thick (ly:grob-property grob 'thickness 0.1))
(xex (ly:stencil-extent sten X))
(lenx (interval-length xex))
(yex (ly:stencil-extent sten Y))
(xtrans (car xex))
(ytrans (car yex))
(uplist
(map pair-to-list
(normalize-coords coords lenx 3))))
(ly:stencil-translate
(my-c-p-s uplist thick)
(cons xtrans ytrans)))
'())))
#(define semi-tone-gliss
(elbowed-glissando '((0.5 . -1.0) (1.0 . 0.15))))
#(define tone-gliss
(elbowed-glissando '((0 . -0.5) (1.0 . -0.35) (1.0 . 0.16))))
#(define three-semi-tone-gliss
(elbowed-glissando '((0 . -0.5) (0.5 . -1.0) (1.0 . -0.35) (1.0 . 0.15))))
glissandoSettings = {
\override Glissando #'Y-offset = #-1
\override Glissando #'thickness = #0.2
\override Glissando #'bound-details =
#'((left (padding . 0.2))
(right (end-on-accidental . #f) (padding . 0.2)))
}
revertGlissando = {
\revert Glissando #'Y-offset
\revert Glissando #'thickness
\revert Glissando #'bound-details
}
semiTone =
#(define-event-function (parser location)()
#{
\tweak #'stencil #semi-tone-gliss
\glissando
#})
tone =
#(define-event-function (parser location)()
#{
\tweak #'stencil #tone-gliss
\glissando
#})
threeSemiTone =
#(define-event-function (parser location)()
#{
\tweak #'stencil #three-semi-tone-gliss
\glissando
#})
\relative c' {
\override Staff.TimeSignature #'stencil = ##f
\override Staff.BarLine #'stencil = ##f
\glissandoSettings
c1
\tone
d
\semiTone
ees
\tone
f
\tone
g
\semiTone
as
\threeSemiTone
b!
\semiTone
c
% \revertGlissando
% c,\glissando
% c''
\revert Staff.BarLine #'stencil
\bar "|."
}
HTH,
Harm