lilypond-user
[Top][All Lists]
Advanced

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

Re: Jazz chords above slash notation


From: Tim McNamara
Subject: Re: Jazz chords above slash notation
Date: Thu, 25 Mar 2021 16:26:54 -0500

Are you thinking of this as a polychord (one chord above another, rather than a chord over a bass note as is usually with a “slash” chord)?

Here is a snippet intended to be used as an \include, if I recall correctly, to denote poly chords in \chordmode  I haven’t had occasion to use it in years, I didn’t write it, and have not tested it against more recent versions of Lilypond since I seem to never need to use polychords.  No doubt something more elegant could be constructed now, but hopefully there is seething helpful in here.


***********************************************
\version "2.18.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."
  (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))))
%}
              
#(define (insert-elt l1 l2 elt)
 "Inserts a new element between every element of list l1
  and outputs this as new list l2.
  While starting, l2 is supposed to be '() "
  (set! l2 (reverse (append (list elt (car l1)) l2)))
  (if (= 1 (length (cdr l1)))
    (append l2 (last-pair l1))
    (insert-elt (cdr l1) (reverse l2) elt)))

#(define-markup-command (dir-column-line layout props direction args)
  (number? markup-list?)
  (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!
         (baseline-skip 0.4)
         (ln-mrkp (markup #:draw-line (cons (car args-length-ls) 0)
                   #:vcenter
                   #:vspace 0.2))
         (new-args (insert-elt args '() ln-mrkp)))
  (stack-lines (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 { \dir-column-line #1
                       { \chord-root-name \transposed-chord-root-name #1 #-1/2 } }
  <c e g d' fis' a'>1-\markup { \dir-column-line #1
                       { \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 = \chords { 
    \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
}


\score {
        \new StaffGroup <<
        <<
        \context ChordNames \theMusic 
        \new Staff = "staff" \relative c' { c1 d e f g }
        >>
        <<
        \context ChordNames \theMusic
        \new Staff = "staff" \relative c' { c1 d e f g }
        >>
        >>
}

**********************************************************

On Mar 24, 2021, at 6:50 PM, Calvin Ransom <calvinjransom@gmail.com> wrote:

Thank you Aaron,
I had to sleep on it and when I woke up it clicked instantly.
I was able to get the chords to work but I ran across a chord that I am not able to write the following chord, If anyone has any ideas on how I can write this I would greatly appreciate it.
This is what my attempt got me so far:
%%%snippet begins%%%
\version "2.22.0"
\score{
  \relative{
    b4^\markup{
      \center-column{
        \line{
          \larger{
            \larger  \override #'(offset . 5)\override #'(thickness . 1) \underline {
              "G"
          }
          }
          \line
          "C"
}
}
}
}
}
}
%%%snippet ends%%% 
<image.png>
Cheers,
Calvin Ransom

On Tue, Mar 23, 2021 at 9:59 PM Aaron Hill <lilypond@hillvisions.com> wrote:
On 2021-03-23 9:26 pm, Calvin Ransom wrote:
> I am trying to write something like the image below. I was able to
> typeset the more normal chords ok but I don’t know how to place parts
> of them in parentheses or how to type the maj9

Review chordNameExceptions and the associated snippet [1] in the
Notation reference.

[1]:
http://lilypond.org/doc/v2.22/Documentation/notation/displaying-chords#index-chordNameExceptions-2


-- Aaron Hill


reply via email to

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