]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/snippets/rhythmic-slashes.ly
Merge branch 'lilypond/translation'
[lilypond.git] / Documentation / snippets / rhythmic-slashes.ly
1 %% Do not edit this file; it is automatically
2 %% generated from LSR http://lsr.dsi.unimi.it
3 %% This file is in the public domain.
4 \version "2.13.39"
5
6 \header {
7   lsrtags = "rhythms, tweaks-and-overrides"
8
9   texidoc = "
10 In @qq{simple} lead-sheets, sometimes no actual notes are written,
11 instead only @qq{rhythmic patterns} and chords above the measures are
12 notated giving the structure of a song. Such a feature is for example
13 useful while creating/transcribing the structure of a song and also
14 when sharing lead sheets with guitarists or jazz musicians. The
15 standard support for this using @code{\\repeat percent} is unsuitable
16 here since the first beat has to be an ordinary note or rest. This
17 example shows two solutions to this problem, by redefining ordinary
18 rests to be printed as slashes. (If the duration of each beat is not a
19 quarter note, replace the @code{r4} in the definitions with a rest of
20 the appropriate duration).
21
22 "
23   doctitle = "Rhythmic slashes"
24 } % begin verbatim
25
26 % Macro to print single slash
27 rs = {
28   \once \override Rest #'stencil = #ly:percent-repeat-item-interface::beat-slash
29   \once \override Rest #'thickness = #0.48
30   \once \override Rest #'slope = #1.7
31   r4
32 }
33
34 % Function to print a specified number of slashes
35 comp = #(define-music-function (parser location count) (integer?)
36   #{
37     \override Rest #'stencil = #ly:percent-repeat-item-interface::beat-slash
38     \override Rest #'thickness = #0.48
39     \override Rest #'slope = #1.7
40     \repeat unfold $count { r4 }
41     \revert Rest #'stencil
42   #}
43 )
44
45 \score {
46   \relative c' {
47     c4 d e f |
48     \rs \rs \rs \rs |
49     \comp #4 |
50   }
51 }
52