lilypond-user
[Top][All Lists]
Advanced

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

Re: Drawing an Oval around a group of notes


From: Klaus Blum
Subject: Re: Drawing an Oval around a group of notes
Date: Mon, 31 Oct 2016 11:21:20 -0700 (MST)

Hi John, 

John Zeweniuk wrote
> Can anybody give me some suggestions  of how I would draw an oval around a
> group of notes on the staff?

the function provided by Robin could serve to adapt snippet 960:
http://lsr.di.unimi.it/LSR/Item?id=960

Here's the result: 
<http://lilypond.1069038.n5.nabble.com/file/n195907/Zwischenablage01.gif> 
% --------------------------------------------------------------------------
colorOval =
#(define-music-function (parser location y-lower y-upper color)
   (number? number? color?)
   #{
     \once \override HorizontalBracket.Y-offset = #0
     \once \override HorizontalBracket.stencil =
     $(lambda (grob)
        (let* (
                (area (ly:horizontal-bracket::print grob))
                (xext (ly:stencil-extent area X))
                (xpos (/ (+ (cdr xext) (car xext)) 2))
                (xrad (/ (- (cdr xext) (car xext)) 2))
                (ypos (/ (+ y-upper y-lower) 2))
                (yrad (/ (- y-upper y-lower) 2))
                (thick (ly:grob-property grob 'thickness 0.05)))
          (ly:stencil-translate
           (ly:make-stencil (list 'ellipse xrad yrad thick #f))
           (cons xpos ypos))))
     % Use the following properties to modify the appearance:
     \once \override HorizontalBracket.layer = #-10 
     \once \override HorizontalBracket.color = $color
     \once \override HorizontalBracket.thickness = #0.5
     \once \override HorizontalBracket.shorten-pair = #'(-1.5 . -1.5)
   #})

\score {
  {
    R1
    \colorOval #-5 #1 #green   % call this before the first note
    c'2\startGroup g' c'\stopGroup
    r2
  }
  \layout {
    \context {
      \Voice
      \consists "Horizontal_bracket_engraver"
    }
  }
}
% --------------------------------------------------------------------------

It can be used to "mark" a sequence of several notes. Lower and upper border
must be given as parameters, zero = middle line.

Cheers, 
Klaus



--
View this message in context: 
http://lilypond.1069038.n5.nabble.com/Drawing-an-Oval-around-a-group-of-notes-tp195873p195907.html
Sent from the User mailing list archive at Nabble.com.



reply via email to

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