[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:14:10 +0100 |
2013/3/16 Thomas Morley <address@hidden>:
> 2013/3/16 Noeck <address@hidden>:
>>> I would like to have brackets/spanners between notes like they are
>>> common in musical education to show semitones (= \/) and tone (= |_|) as
>>> shown on this page: http://www.akkorde.info/dur-akkorde.html
>>> (I would prefer them without slope/ends on same vertical position).
>>
>> I tried also \[ and \] which looks like one of those - but it is always
>> above the staff and the semitone-version is missing.
>>
>> Any ideas, how to achieve this?
>>
>> Joram
>>
>
> Hi Joram,
>
> below some code which seems to do what you want, hijacking Glissando.
[...]
Hi again,
next version, using tweaks in event-functions seems to simplify the input:
\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)))
(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 . -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)))
}
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 "|."
}
-Harm