[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
#(define (bookGenerator please))
From: |
Pierre-Luc Gauthier |
Subject: |
#(define (bookGenerator please)) |
Date: |
Mon, 16 Nov 2015 13:59:16 -0500 |
Hi there,
I have been trying to make a book generator function using scheme
inside Lilypond.
The book generating function itself works but I am the goal would be
to have another function to iterate over a list of parts to be
generated as books.
I cannot seem to find what I am doing wrong since I am just starting
to understand (even slightly) how to use scheme in Lilypond.
Here is what I have to show :
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\version "2.18.2"
\language "english"
piccoloPart = \new Staff {
\new Voice {
\relative c' {
d4 e fs g |
a1\fermata |
}
}
}
bassPart = \new Staff {
\new Voice {
\relative c {
\clef bass
c4 d e f |
g1\fermata |
}
}
}
#(define compilePart
;; This function is used to do and engrave a book
;; $segment should be a musical expression
;; $name should be a string for the book output suffix
(define-void-function (parser location segment name)
(ly:music? string?)
(let ((paper #{ \paper {} #})
(layout #{ \layout {} #})
(book #{ \book { \score { $segment } } #}))
(ly:book-process book paper layout name))))
% _This_ is to test the compilePart function
%\compilePart \piccoloPart #"piccolo"
%\compilePart \bassPart #"bass"
parts = #(list
;; This is a list of parts to be engraved
'("piccolo" . #{ \piccoloPart #} )
'("bass" . #{ \bassPart #} ))
#(define processAllParts
;; This function is used to call the compilePart function for
;; each part entry in the parts list.
(define-void-function (parser location parts)
(list?)
(map
(lambda (p)
(let (
(name (car p))
(music (cdr p))
(show (lambda (name thing)
;; This is in the hope to see what's wrong
(begin
(display (string-append "\nAbout to show "
name ":\n\t"))
(display thing)))))
(begin
(show "parser" parser)
(show "location" location)
(show "name" name)
(show "music" music)
(compilePart parser location music name)
)))
parts)))
% _This_ is to call the processAllParts function with
% the \parts list.
%\processAllParts \parts
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Thanks for reading.
--
Pierre-Luc Gauthier
BookFunction.ly
Description: Text Data
- #(define (bookGenerator please)),
Pierre-Luc Gauthier <=