2015-04-22 2:20 GMT+02:00 Simon Albrecht <[email protected]>: > Hi Harm, > > very impressive, but don’t you also think that it’s a little overkill to > launch such big efforts on this small task? If it were on a larger scale, > the automation would be more efficient, but with myself I observe that I > tend to invest far more time into using as much automation as possible than > I’d have needed with simpler code.
Well, typing the original file must have last some time as well and such a task is error-prone, at least I detected some. Btw, the 'multipleTranspose'-procedure comes from http://lists.gnu.org/archive/html/lilypond-user/2013-09/msg00013.html Thanks David K.! and is far less known... > One comment I added below… > > Yours, Simon > > > Am 22.04.2015 um 01:47 schrieb Thomas Morley: >> >> 2015-04-22 1:32 GMT+02:00 Thomas Morley <[email protected]>: >>> >>> 2015-04-21 19:34 GMT+02:00 SonusProj . <[email protected]>: >>>> >>>> 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 >>>> [email protected] >>>> 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)))) >> >> %% more concise: >> >> #(define (note-name->roman-number-markup pitch lowercase?) >> "Return roman-number-string for @var{pitch}." >> (vector-ref #("i" "ii" "iii" "iv" "v" "vi" "vii") > > or > #("I" "ii" "iii" "IV" "V" "vi" "vii") > in order to differentiate between major and minor. >> >> (ly:pitch-notename pitch)) For that purpose better use: #(define (note-name->roman-number-markup pitch lowercase?) "Return roman-number-string for @var{pitch}." (define (conditional-string-downcase str condition) (if condition (string-downcase str) str)) (conditional-string-downcase (vector-ref #("I" "II" "III" "IV" "V" "VI" "VII") (ly:pitch-notename pitch)) lowercase?)) and uncomment chordNameLowercaseMinor = ##t in the second ChordNames-context >> >>> \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 >> >> _______________________________________________ >> lilypond-user mailing list >> [email protected] >> https://lists.gnu.org/mailman/listinfo/lilypond-user > > _______________________________________________ lilypond-user mailing list [email protected] https://lists.gnu.org/mailman/listinfo/lilypond-user
