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