2015-06-19 6:48 GMT+02:00 David Kastrup <d...@gnu.org>: > Thomas Morley <thomasmorle...@gmail.com> writes: > >> 2015-06-18 23:37 GMT+02:00 David Kastrup <d...@gnu.org>: >>> Thomas Morley <thomasmorle...@gmail.com> writes: >>>> >>>> \version "2.18.2" >>>> >>>> #(define nashville-chord-engraver >>>> (let ((root (ly:make-pitch 0 0 0))) >>> >>> That should rather be >>> >>> #(define (nashville-chord-engraver context) >>> (let ((root (ly:make-pitch 0 0 0))) >>> [...] >>> >> >> Thanks. >> >> Not sure what exactly you mean with the following. >> Is it an additional comment to the above or a second concern? >> >>> In your proposal, all engraver instances share the same "root", a recipe >>> for trouble. > > It is an additional comment on the above. If you have one transposed > voice, for example, having all engravers working with the same "root" is > not going to be a good idea. Or when having a \markup { \score ... } > inside for some purpose, there will still only be one root for both the > enclosing score and the score inside the markup. > > -- > David Kastrup
Hi David, if I understand your hints correctly, then some use-cases will break or at least return wrong/weird output. Though, I wasn't able to find any. May I ask you, if you've the time to find and supply an example, triggering the problem? Here, what I've tried so far (the mainly unchanged engraver is included): \version "2.18.2" #(define (nashville-chord-engraver context) (let ((root (ly:make-pitch 0 0 0))) (define (note-name->international-markup pitch lowercase?) (let* ((diff (ly:pitch-diff pitch root)) (name (ly:pitch-notename diff)) (alt (ly:pitch-alteration diff)) (hspace (vector-ref #(0.15 0.15 0.05 0.05 0.15) (+ (* alt 2) 2))) (raise (vector-ref #(0.6 0.6 0.65 0.8 0.7) (+ (* alt 2) 2)))) (make-line-markup (list (if (= alt 0) ;; If it's natural and not b, do nothing (make-line-markup (list empty-markup)) ;; Else add alteration (make-line-markup (list (make-smaller-markup (make-raise-markup raise (make-musicglyph-markup (assoc-get alt standard-alteration-glyph-name-alist "")))) (make-hspace-markup hspace)))) (make-simple-markup (vector-ref #("1" "2" "3" "4" "5" "6" "7") name)))))) (make-engraver (listeners ((key-change-event engraver event) (set! root (ly:event-property event 'tonic)) (set! (ly:context-property context 'chordRootNamer) note-name->international-markup)))))) %%%%%%%%%%%%%%%%%%%% %% EXAMPLE %%%%%%%%%%%%%%%%%%%% \paper { indent = 0 } \layout { \context { \Score \omit BarNumber } \context { \ChordNames \consists #nashville-chord-engraver } } mI = \chordmode { \key c \major c1 d:m \break \key d \major c_\markup { \score { << \new ChordNames \transpose d bes, \chordmode { \key d \major c } \new Staff \transpose d bes, \chordmode { \key d \major c } >> } } d } mII = \chordmode { \key c \major c1 \key d \major d:m c d } \score { \new StaffGroup << \new ChordNames \mI \new Staff \mI \new ChordNames \transpose c d \mII \new Staff \transpose c d \mII >> } Thanks, Harm _______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user