[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Brackets between notes
From: |
Thomas Morley |
Subject: |
Re: Brackets between notes |
Date: |
Sun, 17 Mar 2013 00:42:59 +0100 |
2013/3/17 Noeck <address@hidden>:
>>
>> Hi Joram,
>>
>> below some code which seems to do what you want, hijacking Glissando.
> …
>> HTH,
>> Harm
>
> Hi Harm,
>
> this is incredible! Thanks a lot! This looks really good.
> With a tiny adjustment, this is exactly what I was looking for.
> (I will probably make the semiTone-bracket a bit flatter.)
>
> Is it difficult to make it not depending on the vertical note position
> (more behaving like piano-pedal brackets), so staying in one line and
> not rising with the scale?
It's not so hard, although I'd prefer the former version.
\version "2.16.2"
#(set-global-staff-size 20)
#(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)))
(downlist
(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 . -0.5) (1.0 . 0.0))))
#(define tone-gliss
(elbowed-glissando '((0 . -0.5) (1.0 . -0.5) (1.0 . 0.0))))
#(define three-semi-tone-gliss
(elbowed-glissando '((0 . -0.3) (0.5 . -0.5) (1.0 . -0.3) (1.0 . 0.0))))
glissandoSettings = {
\override Glissando #'Y-offset = #-4
\override Glissando #'simple-Y = ##f
\override Glissando #'thickness = #0.2
\override Glissando #'bound-details =
#'((left (Y . 0) (padding . 0.2))
(right (Y . 0) (end-on-accidental . #f) (padding . 0.2)))
}
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
\revert Staff.BarLine #'stencil
\bar "|."
}
Please note, you can't switch easily between these two version,
because the behaviour of the brackets is hard-coded.
> And yes, I've subscribed to the German forum. I've read the threads
> there before, but now I feel confident to answer some of the questions.
That's great.
> Thanks,
> Joram
Regards,
Harm