lilypond-user
[Top][All Lists]
Advanced

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

Re: Roman Numeral placement


From: Thomas Morley
Subject: Re: Roman Numeral placement
Date: Wed, 22 Apr 2015 01:32:41 +0200

2015-04-21 19:34 GMT+02:00 SonusProj . <address@hidden>:
> Attached (for ease of reading this post, code not embedded) is a simple
> project that has a staff for C Major and all Major flat keys.  Above each
> 7th chord is the chord name.
>
> I want to add below the chord, treble clef, the associated Roman numeral
> description of each chord.
>
> I.E. on the C Major I would have I, the Dm7 would have ii7 with the 7 in
> superscript, the Em7 would have iii7 with the 7 in superscript, etc.
>
> I see several avenues for this but I don't see an avenue where I can write
> the code once and use many times. I want the Roman numerals to appear for
> all keys and don't want an overly clutter code.
>
> Can someone point me in the correct direction?
>
> Best regards,
> Lance
>
> _______________________________________________
> lilypond-user mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/lilypond-user
>

Hi,

how about:

\version "2.18.2"

\header {
  title = "Root Position 7th Chords"
  composer = "Lance James"
}

diatonicScale =  { c d e f g a b }

chrd = { <c' e' g' b'>1 }

multipleModalTransposes =
#(define-music-function (parser location m music)(ly:music? ly:music?)
  (music-clone m
   'elements
   (map (lambda (pitch)
         (ly:music-property
           #{ \modalTranspose c $pitch $diatonicScale \context Bottom  $music #}
           'element))
        (event-chord-pitches m))))

multipleTransposes =
#(define-music-function (parser location m music)(ly:music? ly:music?)
  (music-clone m
   'elements
   (map (lambda (pitch)
         (ly:music-property #{ \transpose c $pitch $music #} 'element))
        (event-chord-pitches m))))

#(define (note-name->roman-number-markup pitch lowercase?)
  "Return roman-number-markup for @var{pitch}."
    (make-simple-markup
      (vector-ref
        #("i" "ii" "iii" "iv" "v" "vi" "vii")
        (ly:pitch-notename pitch))))

\score {
  \new PianoStaff
    <<
      \new ChordNames
        \multipleTransposes
          { c f bes ees aes des ges ces }
          \multipleModalTransposes \diatonicScale \chordmode { \chrd }

      \new Staff
        \multipleTransposes
          { c f bes, ees aes, des, ges, ces }
          {
            \key c \major
            \multipleModalTransposes \diatonicScale \chrd
            \break
            \bar "||"
          }

      \new ChordNames
        \with {
          minorChordModifier = ""
          %chordNameLowercaseMinor = ##t
          majorSevenSymbol = "7+" %#whiteTriangleMarkup
          chordRootNamer = #note-name->roman-number-markup
          \remove "Staff_performer"
        }
        \repeat unfold 8
          \multipleModalTransposes \diatonicScale \chordmode { \chrd }

     \new Staff {
       \clef bass
       \multipleTransposes
         { c f bes ees aes des ges ces' }
         {
           \key c \major
           \multipleModalTransposes \diatonicScale \transpose c c,, \chrd
         }
       \bar "|."
     }
    >>

  \layout {
    \context {
      \Staff
      explicitKeySignatureVisibility = #end-of-line-invisible
      printKeyCancellation = ##f
    }
  }
  \midi { }
}


Cheers,
  Harm



reply via email to

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