]> git.donarmstrong.com Git - lilypond.git/blob - input/regression/scheme-book-scores.ly
cd500bea6c169c9beb9a3ad6d8aa54d0159a29d8
[lilypond.git] / input / regression / scheme-book-scores.ly
1 \version "2.13.4"
2
3 \header {
4
5   texidoc = "Scores can be generated with scheme, too, and inserted into the
6 current book(part). Generated and explicit scores can be mixed, the header
7 informations from top- and booklevel stack correctly."
8
9 }
10
11 #(use-modules (scm display-lily))
12
13 % Sample score, which adds a score (containing just one note) to the current
14 % book/bookpart/at toplevel using scheme rather than the parser.
15 % That score is supposed to use the global header information, too.
16 #(define add-one-note-score 
17    (let ((pitch 0))
18         (lambda (parser)
19           (let* ((scmpitch (ly:make-pitch 0 pitch 0))
20                  (music (make-music 'EventChord
21                           'elements (list (make-music 'NoteEvent
22                                             'duration (ly:make-duration 2 0 1 1)
23                                             'pitch scmpitch))))
24                  (score (scorify-music music parser))
25                  (layout (ly:output-def-clone $defaultlayout))
26                  (desc (markup #:large #:line ((ly:format "Score with a ~a"
27                                 (note-name->lily-string scmpitch parser))))))
28             (ly:score-add-output-def! score layout)
29             (add-text parser desc)
30             (add-score parser score))
31             (set! pitch (modulo (1+ pitch) 7)))))
32
33 oneNoteScore =
34 #(define-music-function (parser location) ()
35    (add-one-note-score parser)
36    (make-music 'Music 'void #t))
37
38 %%%
39
40 \header {
41   title = "Main Title"
42   subtitle = "Main subtitle"
43   piece = "Piecetitle"
44 }
45
46 \oneNoteScore
47
48 \bookpart {
49   \header { title ="Title 1" subtitle="Sub1"}
50   \oneNoteScore
51   \score { \relative c' c1 }
52   \oneNoteScore
53 }
54
55
56 \bookpart {
57   \score { \relative c' c1 }
58   \oneNoteScore
59 }
60
61 \oneNoteScore
62