lilypond-user
[Top][All Lists]
Advanced

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

Accidentals in roots of chordNames: tweaking size and placement


From: alamire
Subject: Accidentals in roots of chordNames: tweaking size and placement
Date: Wed, 18 Nov 2015 21:43:39 -0700 (MST)

First, thanks to everyone for what I have learned here without posing new
questions!

I am customizing the display of chordNames and have built on solutions by
Matthias Hüsken and others. However, without any ability in defining
functions with scheme, I am at a loss how to call the regular flat and sharp
glyphs when defining a markup.

In the MWE below, I would like the flat in the root name to appear identical
to the flat in the "m7b5" chord. I do *not* want to continue using the text
markup font via unicode.

Grateful for any help! I will be happy to share an attractive
voice-and-piano template when this is resolved. You will see that I could
also use assistance adding support for double-sharps and double-flats in the
root names, but that is a low priority.

-------------------------------------------------

\version "2.18.2"
\language "english"

\new ChordNames \chordmode {
  ef1 ef:m ef:dim ef:7 ef:m7 ef:maj7 ef:dim7 ef:m7.5-
}

chflat = \markup {
  \hspace #0.2 \fontsize #-3 \raise #0.5 \flat \hspace #0.2
}

chsharp = \markup {
  \hspace #0.2 \fontsize #-3 \raise #0.8 \sharp \hspace #0.2
}

chordQualities = {
  <c e g>1
  <c ef g>-\markup { "m" }
  <c ef gf>-\markup { "dim" }
  <c ef g bf>-\markup { "m7" }
  <c e g b>-\markup { "maj7" }
  <c e g bf>-\markup { "7" }
  <c e bf>-\markup { "7(no5)" }
  <c ef gf bf>-\markup \concat { "m7" \chflat "5" }
  <c ef gf bff>-\markup { "dim7" }
}

chordQualityFormat =
#(append (sequential-music-to-chord-exceptions chordQualities #t)
   ignatzekExceptions)

#(define (conditional-string-downcase str condition)
   (if condition
       (string-downcase str)
       str))

#(define (chordRootFormat pitch lowercase?)
   (let* ((alt (ly:pitch-alteration pitch)))
     (make-line-markup
      (list
       (make-simple-markup
        (conditional-string-downcase
         (vector-ref #("C" "D" "E" "F" "G" "A" "B") (ly:pitch-notename
pitch))
         lowercase?))
       ;; natural
       (if (= alt 0)
           (make-line-markup (list empty-markup))
           (if (= alt FLAT)
               ;; flat
               (make-line-markup
                (list
                 (make-hspace-markup 0)
                 (make-text-markup "♭")
                 (make-hspace-markup 0)
                 ))
               ;; sharp
               (if (= alt SHARP)
                   (make-line-markup
                    (list
                     (make-hspace-markup 0)
                     (make-text-markup "♯")
                     (make-hspace-markup 0)
                     ))
                   ;; other
                   (make-line-markup
                    (list (make-text-markup "(error!)"))
                    )
                   )
               ))
       ))))

\layout {
  \context {
    \Score
    chordNameExceptions = #chordQualityFormat
    chordRootNamer = #chordRootFormat
  }
}





--
View this message in context: 
http://lilypond.1069038.n5.nabble.com/Accidentals-in-roots-of-chordNames-tweaking-size-and-placement-tp183759.html
Sent from the User mailing list archive at Nabble.com.



reply via email to

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