lilypond-user
[Top][All Lists]
Advanced

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

Re: Arpeggios from chordmode?


From: Gilles
Subject: Re: Arpeggios from chordmode?
Date: Mon, 01 Aug 2011 17:00:29 +0200
User-agent: Opera Mail/11.50 (Win32)


Is there as simple way to get chord mode to return:

c4 e g

instead of

<c e g>4


Is something like that what you wanted ?

%%%%%%%%%%%%%%%%%%%%%%%%
#(use-modules (ice-9 receive))
%% see http://www.gnu.org/software/guile/manual/guile.html#Multiple-Values

#(define (chords-list->seq-list lst)
(receive (notes others)
         (partition (lambda(x) (ly:duration? (ly:music-property x
'duration)))
lst)
     (map (lambda(x)
            (let ((elts (list x)))
              (if (pair? others)(begin
                 (set! elts (append elts others))
                 (set! others '())))
              (make-music 'EventChord 'elements elts)))
           notes)))

chordsToSeq = #(define-music-function (parser location music)(ly:music?)
(music-map
        (lambda (x)
          (if (eq? 'EventChord (ly:music-property x 'name))
            (make-music 'SequentialMusic 'elements
                (chords-list->seq-list (ly:music-property x 'elements)))
            x))
        music))


music = \chordmode {d4:min7\f g:7 c:maj7}

\new Voice \chordsToSeq \music
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Gilles

Attachment: chordsToSeq.png
Description: PNG image


reply via email to

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