|
From: | Jean Abou Samra |
Subject: | Re: Printing Chordnames as Roman Numbers |
Date: | Wed, 01 Mar 2023 10:21:49 +0100 |
User-agent: | Evolution 3.46.4 (3.46.4-1.fc37) |
Le mercredi 01 mars 2023 à 09:54 +0100, Johan Smolinski a écrit :
I asked this in the facebook group, but was rdirected to this mailing list, so... Here I am. :)
How can I print chordnames as roman numbers relative to given key? For instance, in key of C (given by \key c \major), I want the chord c:7 printed as I7 while in key of F, I want c:7 printed as V7.
You could use a Scheme engraver.
Try this:
\version "2.24.1"
\layout {
\context {
\ChordNames
\consists
#(lambda (context)
(let ((tonic #{ c #}))
(make-engraver
((initialize engraver)
(set! (ly:context-property context 'chordRootNamer)
(lambda (pitch capitalized)
(let ((degree (1+ (ly:pitch-notename (ly:pitch-diff pitch tonic)))))
(number-format 'roman-upper degree)))))
(listeners
((key-change-event engraver event)
(set! tonic (ly:event-property event 'tonic)))))))
}
}
\chords {
a1 b1:m c1 d2:sus4
\key a \minor
a1 b1:m c1 d2:sus4
}
HTH,
Jean
signature.asc
Description: This is a digitally signed message part
[Prev in Thread] | Current Thread | [Next in Thread] |