Dear Simon, this is just perfect!
Thank you very much.

~Pierre

2015-10-10 20:30 GMT+02:00 Simon Albrecht <simon.albre...@mail.de>:

> 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
>
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to