lilypond-user-fr
[Top][All Lists]
Advanced

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

Re: rétrogradation


From: Gilles THIBAULT
Subject: Re: rétrogradation
Date: Mon, 26 Jan 2015 13:53:04 +0100
User-agent: KMail/4.12.5 (Linux/3.14.27-desktop-1.mga4; KDE/4.12.5; x86_64; ; )

> Par contre au passage, la fonction \retrograde a un bug pour les liaisons :
> elle devrait  transformer les ( en ) et inversement, pour préservé les
> liaisons.

Comme ceci, ça a l'air de marcher :

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

#(define-public (retrograde-music music)
  "Returns @var{music} in retrograde (reversed) order."
  ;; Copied from LSR #105 and renamed.
  ;; Included here to allow this module to provide a complete set of
  ;; common formal operations on motives, i.e transposition,
  ;; inversion and retrograding.

(let* ((elements (ly:music-property music 'elements))
       (reversed (reverse elements))
       (artis (ly:music-property music 'articulations))
       (element (ly:music-property music 'element))
       (change-span-dir 
        (lambda(arti)
          (let ((span-dir (ly:music-property arti 'span-direction)))
            (if (ly:dir? span-dir) (ly:music-set-property! arti 
                                       'span-direction (- span-dir)))
            arti))))
  (if (ly:music? element) (ly:music-set-property! music 'element
                            (retrograde-music element)))
  (if (pair? elements)(ly:music-set-property! music 'elements 
                            (map retrograde-music reversed)))
  (if (pair? artis) (ly:music-set-property! music 'articulations 
                            (map change-span-dir artis)))
  music))

%%%%%%%%% test
\version "2.18.2"

music = \relative c'  { c8. ees16( fis8. a16 b8.) gis16 f8. d16 }

\new Staff {
  \music
  \retrograde \music  % \retrograde est mis à jour automatiquement !!!
  %#(retrograde-music (ly:music-deep-copy music))
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

-- 
Gilles



reply via email to

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