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

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

Re: Arranger.ly dispatch-chords


From: Gilles Thibault
Subject: Re: Arranger.ly dispatch-chords
Date: Wed, 04 Nov 2020 00:54:04 +0100
User-agent: Webmail Free/1.3.3

Le 2020-11-02 17:18, Clément CAILLOL a écrit :
Merci beaucoup ! Je vais essayer de comprendre comment ça fonctionne,
et je vais utiliser ça !

Bon finalement il semble qu'une fonction multi-dispatch-chords est possible. J'essaierai de la tester dans mes arrangements pour voir si on peut l'intégrer à arranger.ly

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\version "2.20.0"
\include "arranger.ly"

%%%%%%%%%%%%%% Préparation

#(define* (part-combine-instru instru1 instru2 #:optional (clef "treble"))
"Combine 2 instruments in 1 part"
(sim  ; << ... >>
  (make-clef-set clef)
  global
  #{ \set Staff.instrumentName = \markup \center-column {
         #(symbol->string instru1)    % 'fl1 -> "fl1"
         #(symbol->string instru2)
         } #}
  (part-combine (obj->music instru1)  ; 'fl1 -> fl1
                (obj->music instru2))))

global = s1*5
#(init '(fl1 fl2 htb1 htb2 fag1 fag2 tp1 tp2 cor1 cor2))

%%%%%%%%%%%%%% multi-dispatch-chords

#(define (multi-dispatch-chords list-of-instrus-list where-pos music-with-chords) "Dispatches chord 1 of music-with-chords into the instruments of the first list of list-of-instrus-list, then goes on with the 2nd chord and the 2nd list etc..."
(let((n (pos:num where-pos))) ; arranger.ly internal func: '(7 4 2) -> 7
(let loop ((chords-list (extract-named-music music-with-chords 'EventChord))
             (instr-list list-of-instrus-list)
(mom (pos:remain where-pos))) ; '(7 4 2) -> <mom 1/4> + <mom 1/2>
    (if (and (pair? chords-list)
             (pair? instr-list))
      (let((instrus (car instr-list))
           (chord (car chords-list)))
         (dispatch-chords instrus (list n mom) chord)
         (loop (cdr chords-list)
               (cdr instr-list)
               (ly:moment-add mom (ly:music-length chord))))
(apply-to (delete-duplicates (flat-lst list-of-instrus-list) eq?) ; minimum list (set-pat music-with-chords #t) ; rhythm pattern applied to each instru
                where-pos (list n mom))))))    % from to parameters

#(multi-dispatch-chords
  '((fl1 (fl2 htb1) (htb2 tp1) cor1 tp2 (fag1 cor2) fag2)
    (fl1 fl2 (htb1 tp1) htb2  tp2 (cor1 fag1) fag2 cor2)
    (fl1 fl2 (tp1 tp2) htb1 htb2 (cor1 cor2) fag1 fag2))
  2
  #{ <c c' e' g' c'' e'' c'''>4 r r2
     <g b d' g' b' d'' b'' d'''>4 r r2
     <fis a d' a' c'' d'' a'' c'''>4 r r2
  #})


\markup "multi-dispatch-chords"
{ <<
  \new Staff $(part-combine-instru 'fl1 'fl2)
  \new Staff $(part-combine-instru 'htb1 'htb2)
  \new Staff $(part-combine-instru 'tp1 'tp2)
  \new Staff $(part-combine-instru 'cor1 'cor2)
  \new Staff $(part-combine-instru 'fag1 'fag2 "bass")

}


--
Gilles



reply via email to

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