[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

music variables and music templates - an idea

From: Jan-Peter Voigt
Subject: music variables and music templates - an idea
Date: Tue, 18 Oct 2011 12:41:38 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv: Gecko/20110921 Lightning/1.0b2 Thunderbird/3.1.15

Hello list,

I created some functions to store music in a hierarchical tree. This "music store" leads to the possibility to store music in one place and to get voices/parts in a defined template. If you have to put several choral pieces in one book, you can first fill all voices in this tree with a structure <piece>/notes/[sop|alt|ten|bas] and then later refer to that music in a common SATB-template. If your book shall have another look for all choral pieces, you only have to change the template. And if you want to combine several pieces in one bookpart, you can first \include all music definitions, then display the music where you like to.

In this example file, I inserted one choral piece (SATB), wich is first displayed in a four-stave-four-lyric-system, then in a two-stave-one-lyric-system.

In the underlying tree, wich is an alist, you can access values by path, wich is a list of symbols - for example (tree-get tree '(path to value))
One value can be stored in path '()
Like with assoc-set!, the actual tree is not modified, but the modified is returned. These tree-functions are used in the get/put-music-functions, wich are actually defined in a closure.

If I typeset pieces, I use a modified include-function, wich only includes, if the outname equals the location-name. This way I can "\includeLocal" a testfile, wich instantiates the current piece (wich is set before) only if I am working on that specific file:
#(define-public includeLocal (define-music-function (parser location file)(string?)
    (let ((outname (format "" (ly:parser-output-name parser)))
          (locname (car (ly:input-file-line-char-column location))))
         (if (string=? outname locname)
             (let ((content (ly:gulp-file file)))
                  (ly:parser-include-string parser content)))
         (make-music 'SequentialMusic 'void #t))))

I know, this is another way to handle this multi-score-in-one-book-thing. But perhaps it includes at least some useful ideas. If this is of interest, I'd like to get respond and suggestions to improve it.


Description: Text Data

reply via email to

[Prev in Thread] Current Thread [Next in Thread]