Clip systems: Difference between revisions
Appearance
	
	
 Import snippet from LSR  | 
				 Remove output  | 
				||
| Line 1: | Line 1: | ||
This code shows how to clip (extract) snippets from a full score.  | This code shows how to clip (extract) snippets from a full score.  | ||
This file needs to be run separately with <code>-dclip-systems</code>; the   | This file needs to be run separately with <code>-dclip-systems</code>; the output cannot be shown on this Wiki due to technical limitations. The result will be files named ''<code>base</code>''<code>-from-</code>''<code>start</code>''<code>-to-</code>''<code>end</code>''<code>[-</code>''<code>count</code>''<code>].eps</code>.  | ||
If system starts and ends are included, they include extents of the System grob, e.g., instrument names.  | If system starts and ends are included, they include extents of the System grob, e.g., instrument names.  | ||
| Line 9: | Line 9: | ||
Regions can span multiple systems. In this case, multiple EPS files are generated.  | Regions can span multiple systems. In this case, multiple EPS files are generated.  | ||
<  | <pre>  | ||
\version "2.24.0"  | |||
#(ly:set-option 'clip-systems)  | #(ly:set-option 'clip-systems)  | ||
#(ly:set-option 'separate-page-formats 'ps)  | #(ly:set-option 'separate-page-formats 'ps)  | ||
| Line 71: | Line 73: | ||
   }  |    }  | ||
}  | }  | ||
</  | </pre>  | ||
[[Category:Paper and layout]]  | [[Category:Paper and layout]]  | ||
[[Category:Included in the official documentation]]  | [[Category:Included in the official documentation]]  | ||
Latest revision as of 23:34, 26 October 2025
This code shows how to clip (extract) snippets from a full score.
This file needs to be run separately with -dclip-systems; the output cannot be shown on this Wiki due to technical limitations. The result will be files named base-from-start-to-end[-count].eps.
If system starts and ends are included, they include extents of the System grob, e.g., instrument names.
Grace notes at the end point of the region are not included.
Regions can span multiple systems. In this case, multiple EPS files are generated.
\version "2.24.0"
#(ly:set-option 'clip-systems)
#(ly:set-option 'separate-page-formats 'ps)
#(define output-suffix "1")
origScore = \score {
  \relative c' {
    \new Staff \with { instrumentName = "Instrument" }
    c1
    d1
    \grace c16 e1
    \key d \major
    f1 \break
    \clef bass
    g,1
    fis1
  }
}
\book {
  \score {
    \origScore
    \layout {
      % Each clip-region is a (START . END) pair
      % where both are rhythmic-locations.
      % (make-rhythmic-locations BAR-NUMBER NUM DEN)
      % means NUM/DEN whole-notes into bar numbered BAR-NUMBER
      clip-regions = #(list
      (cons
       (make-rhythmic-location 2 0 1)
       (make-rhythmic-location 4 0 1))
      (cons
       (make-rhythmic-location 0 0 1)
       (make-rhythmic-location 4 0 1))
      (cons
       (make-rhythmic-location 0 0 1)
       (make-rhythmic-location 6 0 1))
      )
    }
  }
}
#(ly:set-option 'clip-systems #f)
#(ly:set-option 'separate-page-formats #f)
#(define output-suffix #f)
\book {
  \score { \origScore }
  \markup { \bold \fontsize #6 clips }
  \score {
    \lyrics {
      \markup { from-2.0.1-to-4.0.1-clip.eps }
      \markup {
        \epsfile #X #30.0 #(format #f "~a-1-from-2.0.1-to-4.0.1-clip.eps"
                            (ly:parser-output-name)) }
    }
  }
}