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

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

Re: rétrogradation


From: Pierre Perol-Schneider
Subject: Re: rétrogradation
Date: Mon, 26 Jan 2015 14:19:18 +0100

Joli !
Merci Gilles.
Pierre

2015-01-26 13:53 GMT+01:00 Gilles THIBAULT <address@hidden>:

> 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

_______________________________________________
liste de diffusion lilypond-user-fr
address@hidden
https://lists.gnu.org/mailman/listinfo/lilypond-user-fr


reply via email to

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