lilypond-user
[Top][All Lists]
Advanced

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

Re: scheme code generate variable series with leading "\"


From: Jan-Peter Voigt
Subject: Re: scheme code generate variable series with leading "\"
Date: Mon, 8 Aug 2016 14:13:00 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0

Hi Ming,

it can be done:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\version "2.19.47"

mel.0 = { <>^\markup{\box\bold"Verse"} g8 8 |}
mel.1 = { c'8. 16~8 b d' c'~8 b~ |}
mel.2 = { b8 a'8~4 r8 g'8 8 8 |}
mel.3 = { f'4. e'8 g' a c'8 16 e'16~ | \break }
mel.4 = { e'8 d'~4~4. g'8 |}
mel.5 = { a'4. g'8 4. e'16 f' |}
mel.6 = { g'8 f'16 g'~8 f' e'4. d'8 |}
mel.7 = { c'4 r16 c'16 a c' a'8 e'16 f'~8 g'~ | \break }

% make a sequence (there's probably a predefined function)
#(define (seq start end)
   (cons start
     (if (< start end) (seq (1+ start) end) '())))

% display string-version
#(display (string-join (map (lambda (i) (format "\\mel.~A" i)) (seq 0 7)) "\n" 'infix))

{
  \partial 4
  % produce immediate scheme expression
$(make-music 'SequentialMusic 'elements (map (lambda (i) (assoc-get i mel)) (seq 0 7)))
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

You can either produce a string containing the needed lilypond code or you create SimultaneousMusic with a list of the resulting var members.

In your example 'mel' turns out to be an assoc-list with the keys 0..7. Using map you can produce a list of music expressions.

HTH
Jan-Peter

Am 08.08.2016 um 13:49 schrieb MING TSANG:
Dear lilyponders:
I do not know scheme code. Can scheme code to generate variable series
with leading "\"?
Detail question in the lily file attachment.
Thank you for any help.
Immanuel,
Ming.



_______________________________________________
lilypond-user mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/lilypond-user





reply via email to

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