-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Montag, 2. Februar 2009 10:09:55 今井雄治 wrote:
> Hi users.
>
> I want to customize rest by its duration, as following
>     r4 --> black circle
>     r8 --> black circle with under line

Attached is a scheme example how to do this (it checks the duration-log, i.e. 
a quarter rest has a 2-log of 2, an eighth rest has a 2-log of 3, since 
1/8=2^(-3)). Quarter and eighth rests are printed the way you want them, all 
other rests are printed as usual.

The example assigns that function globally. If you want it only for some 
parts, you can simply remove the \layout block and do:

\relative {
    e4. r8 e4 r4
    \override Rest #'stencil = #ly:rest-interface::dot-rests
    e4. r8 e4 r4
    \reset Rest #'stencil
    e4. r8 e4 r4
}

Also note that I changed the circle call from a radius of 0.6 and a thickness 
of 0 to a radius of 0.55 and a thickness of 0.1 (half of the thickness will be 
outside the radius, half of it inside!), because then you get nice anti-
aliasing and the circle will look really rounded.

I've also added that snippet to the LSR, together with some explanations:
http://lsr.dsi.unimi.it/LSR/Item?id=548

Cheers,
Reinhold

- -- 
- ------------------------------------------------------------------
Reinhold Kainhofer, reinh...@kainhofer.com, http://reinhold.kainhofer.com/
 * Financial & Actuarial Math., Vienna Univ. of Technology, Austria
 * http://www.fam.tuwien.ac.at/, DVR: 0005886
 * LilyPond, Music typesetting, http://www.lilypond.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iD8DBQFJhvprTqjEwhXvPN0RAuUdAJ9h6p/9ZK7VkL4ykzmE3UnBCGxIYACfYZzu
cgRAhYLRm8l/sGtW4A9k6Fo=
=rt1E
-----END PGP SIGNATURE-----

Attachment: rounded_rests.pdf
Description: Adobe PDF document

\version "2.12.3"

% Our own stencil for rests: quarter rests are shown as a centered filled circle, 
% eighth rests are an underlined filled circle:
#(define (ly:rest-interface::dot-rests grob)
  (let* ((duration (ly:grob-property grob 'duration-log))
         (circle (ly:stencil-translate-axis (make-circle-stencil 0.55 0.1 #t) 0.3 X)))
    (case duration
      ((2) circle)
      ((3) (ly:stencil-add 
               circle
               (make-filled-box-stencil '(-0.275 . 0.9) '(-1.35 . -1.0))))
      (else (ly:rest::print grob)))
  )
)

\layout {
  \context { \Voice
    \override Rest #'stencil = #ly:rest-interface::dot-rests
  }
}

\relative {
    r1 |
    r2 e2 |
    e4. r8 e4 r4 |
    r8. r16 r4. r8 e4 |
}

% If you want this rest style only for some parts of a score, remove the 
% \layout block above and simply override the Rest stencil wherever you want.
% After the block with circle rests, simply revert the stencil property to its
% default values:
% \relative {
%     e4. r8 e4 r4
%     \override Rest #'stencil = #ly:rest-interface::dot-rests
%     e4. r8 e4 r4
%     \revert Rest #'stencil
%     e4. r8 e4 r4
% }
% 
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to