]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/snippets/new/clip-systems.ly
Snippets: Replace \set Staff.instrumentName
[lilypond.git] / Documentation / snippets / new / clip-systems.ly
1 \version "2.19.56"
2
3 \header {
4   lsrtags = "paper-and-layout"
5
6   texidoc = "
7 This code shows how to clip (extract) snippets from a full score.
8
9 This file needs to be run separately with @code{-dclip-systems}; the
10 snippets page may not adequately show the results.
11
12 The result will be files named
13 @samp{base-from-start-to-end[-count].eps}.
14
15
16 If system starts and ends are included, they include extents of the
17 System grob, e.g., instrument names.
18
19
20 Grace notes at the end point of the region are not included.
21
22
23 Regions can span multiple systems.  In this case, multiple EPS files
24 are generated.
25
26 "
27   doctitle = "Clip systems"
28 } % begin verbatim
29
30 #(ly:set-option 'clip-systems)
31 #(define output-suffix "1")
32
33 origScore = \score {
34   \relative c' {
35     \new Staff \with { instrumentName = "Instrument" }
36     c1
37     d1
38     \grace c16 e1
39     \key d \major
40     f1 \break
41     \clef bass
42     g,1
43     fis1
44   }
45 }
46
47 \book {
48   \score {
49     \origScore
50     \layout {
51       % Each clip-region is a (START . END) pair
52       % where both are rhythmic-locations.
53
54       % (make-rhythmic-locations BAR-NUMBER NUM DEN)
55       % means NUM/DEN whole-notes into bar numbered BAR-NUMBER
56
57       clip-regions = #(list
58       (cons
59        (make-rhythmic-location 2 0 1)
60        (make-rhythmic-location 4 0 1))
61
62       (cons
63        (make-rhythmic-location 0 0 1)
64        (make-rhythmic-location 4 0 1))
65
66       (cons
67        (make-rhythmic-location 0 0 1)
68        (make-rhythmic-location 6 0 1))
69       )
70     }
71   }
72 }
73
74 #(ly:set-option 'clip-systems #f)
75 #(define output-suffix #f)
76
77 \book {
78   \score { \origScore }
79   \markup { \bold \fontsize #6 clips }
80   \score {
81     \lyrics {
82       \markup { from-2.0.1-to-4.0.1-clip.eps }
83       \markup {
84         \epsfile #X #30.0 #(format #f "~a-1-from-2.0.1-to-4.0.1-clip.eps"
85                             (ly:parser-output-name)) }
86     }
87   }
88 }