[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Selected pieces in a book
From: |
Simon Albrecht |
Subject: |
Re: Selected pieces in a book |
Date: |
Sat, 10 Oct 2015 20:30:10 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 |
Hello Pierre,
On 10.10.2015 19:41, Pierre Perol-Schneider wrote:
Hi LilyPonders,
I'm trying to automagically select pieces within a library.
My first intention was to use 'tags' but it does not seem to work a
that level.
\tag is a music function, so it can’t output scores.
Any idea how to achieve that ?
I’d use some Scheme code:
%%%%%%%%%%%%%%%%%%%%%%
\version "2.19.28"
my-first-piece = \relative c' {
\mark "Level 1"
c1 d e f g a b c
}
my-second-piece = \relative c' {
\mark "Level 1"
c2 d e f g a b c
}
my-third-piece = \relative c' {
\mark "Level 2"
c4 d e f g a b c
}
my-fourth-piece = \relative c' {
\mark "Level 2"
c8 d e f g a b c
}
%% define scheme lists of music expressions for each level
#(define level-one (list my-first-piece my-second-piece))
#(define level-two (list my-third-piece my-fourth-piece))
#(define (print-by-level lst)
;; wrap each music expression into \score {}
;; and add each of the scores to the bookpart
(let ((print-piece (lambda (mus)
#{ \score { $mus } #})))
;; see ‘scm/lily-library.scm’ for add-score
;; (and many other useful procedures)
(map add-score (map print-piece lst))))
%% Select pieces by level:
\book {
\bookpart {
%% Select only 'level 1 pieces':
#(print-by-level level-one)
%}
\header {
title = "Level I"
}
}
\bookpart {
%% Select only 'level 2 pieces':
#(print-by-level level-two)
%}
\header {
title = "Level II"
}
}
}
%%%%%%%%%%%%%%%%%%%
It has been a personal breakthrough to discover the use of these
functions from lily-library.scm…
I hope you can make sense and use of that :-)
Yours, Simon