lilypond-user
[Top][All Lists]
Advanced

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

Polychord


From: achard
Subject: Polychord
Date: Fri, 27 Nov 2020 13:52:07 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0

Bonjour.

Voilà ce qu'un utilisateur a écrit pour avoir des polychords.

Mais j'aimerais que l'accord du bas puisse apparaître sous la forme C7 ou Cm7 ou C maj7.

Je ne suis pas assez expert en Scheme. Si quelqu'un peut m'aider, merci d'avance. Bonne journée.

Jean-Pierre Achard


\version "2.14.0"

#(define-markup-command (transposed-chord-root-name layout props a b) (number? number?)
  #:properties ((cause #f))
  "Print the root of the chord transposed."
  (interpret-markup layout props
    (markup (note-name->markup
             (ly:pitch-transpose (ly:event-property cause 'pitch) (ly:make-pitch 0 a b))
                                #f))))

#(define-markup-command (chord-root-name layout props) ()
  #:properties ((cause #f))
  "Print the root of the chord transposed."
  (interpret-markup layout props
    (markup (note-name->markup (ly:event-property cause 'pitch) #f)
    )))

#(define-public (silent-chord-root-namer pitch lowercase?)
   (markup "")
)

#(define-markup-command (polychord-column layout props args)
 (markup-list?)
  ;#:properties ((direction)
  ;(baseline-skip))

 (let* ((args-length-ls (sort (map (lambda (x)
               (interval-length
                  (ly:stencil-extent
                     (interpret-markup layout props x)
                   X)))
               args)
                     >))
       ; baseline-skip is hard-coded!
       ; if you change this don't forget to change 0.65
       ; in: #:translate (cons 0 (* 0.65 baseline-skip))
       (baseline-skip 1.4)
       (ln-mrkp (markup #:translate (cons 0 (* 0.65 baseline-skip))
                    #:draw-line (cons (car args-length-ls) 0)))
       (new-args (list (car args) ln-mrkp (cadr args))))
       ; direction is hard-coded!
 (stack-lines 1 ;(if (number? direction) direction -1)
              0.0
              baseline-skip
              (interpret-markup-list layout props new-args))))

polychordExceptionMusic = {
  <c e g des' f' aes'>1-\markup { \polychord-column
                       { \chord-root-name \transposed-chord-root-name #1 #-1/2 } }
  <c e g d' fis' a'>1-\markup { \polychord-column
                       { \chord-root-name \transposed-chord-root-name #1 #0 } }
}

%#(top-repl)

polychordExceptions = #( append
  ( sequential-music-to-chord-exceptions polychordExceptionMusic #t)
 ignatzekExceptions)

cmJazz = {
  \set chordNameExceptions = #ignatzekExceptions
  \set chordRootNamer = #note-name->markup
}

cmPoly = {
  \set chordNameExceptions = #polychordExceptions
  \set chordRootNamer = #silent-chord-root-namer
}

theMusic = \chordmode {
    \cmPoly
       c1:5.9-.11.13-
       c1:5.9.11+.13
       des1:5.9.11+.13
       fis1:5.9.11+.13
       \cmJazz
       c1:5.9-.11.13-
}

\layout {
  ragged-right = ##t
}

<< \context ChordNames \theMusic
   \context Voice \theMusic





reply via email to

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