\version "2.19.4" \language "english" %%%%%%%%%%%%%%%\include "include_solfege-engraver.ly" #(define syllables '("do" "re" "mi" "fa" "so" "la" "ti")) #(define syls '("d" "r" "m" "f" "s" "l" "t")) #(define numR➀ '("➀" "➁" "➂" "➃" "➄" "➅" "➆")) #(define number '("1" "2" "3" "4" "5" "6" "7")) #(define numR➑ '("➊" "➋" "➌" "➍" "➎" "➏" "➐")) #(define (solfege-engraver lst dir) (make-engraver (acknowledgers ((note-head-interface engraver grob source) (let* ( (context (ly:translator-context engraver)) (tonic-pitch (ly:context-property context 'tonic)) (tonic-index (ly:pitch-notename tonic-pitch)) (event (ly:grob-property grob 'cause)) (event-copy (ly:event-deep-copy event)) (grob-pitch (ly:event-property event 'pitch)) (grob-index (ly:pitch-notename grob-pitch)) (delta (modulo (- grob-index tonic-index) 7)) (name (list-ref lst delta)) (newgrob (ly:engraver-make-grob engraver 'TextScript event-copy))) ;; clear 'tweaks for newgrob (ly:event-set-property! event-copy 'tweaks '()) (if (string= name "Hb") (set! name "B")) ;; Give newgrob 'outside-staff-priority depending on ;; grob 'staff-position (set! (ly:grob-property newgrob 'outside-staff-priority) (+ (ly:grob-property newgrob 'outside-staff-priority) (* dir (ly:grob-property grob 'staff-position)))) (set! (ly:grob-property newgrob 'text) name) (set! (ly:grob-property newgrob 'direction) dir) ))))) xup = \with { \consists #(solfege-engraver syllables UP) } xdown = \with { \consists #(solfege-engraver syllables DOWN) } zup= \with { \consists #(solfege-engraver syls UP) } zdown= \with { \consists #(solfege-engraver syls DOWN) } nup= \with { \consists #(solfege-engraver number UP) } ndown= \with { \consists #(solfege-engraver number DOWN) } rup= \with { \consists #(solfege-engraver numR➀ UP) } rdown= \with { \consists #(solfege-engraver numR➀ DOWN) } sup= \with { \consists #(solfege-engraver numR➑ UP) } sdown= \with { \consists #(solfege-engraver numR➑ DOWN) } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%end clors = #(define-music-function (parser location which color music) ((procedure? car) color? ly:music?) (music-map (lambda (mus) (if (music-is-of-type? mus 'event-chord) (let* ((evt-chrd-nts (event-chord-notes mus))) (if (> (length evt-chrd-nts) 1) (let ((first-nh (which evt-chrd-nts))) #{ \tweak #'color #color #first-nh #}) mus) mus) mus)) music)) % default #first #last is the top notehead %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% boo = #(define-music-function (parser location color the-music) (color? ly:music?) #{ \temporary \override NoteHead.color = #color #the-music \revert NoteHead.color #}) %\boo#blue {..} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SA = { d''4. d''8 d''8 8 8 f'8 |%m73 <<{\voiceOne a'2 a'4 f'8 e'8}\new Voice{\voiceTwo \boo#red {c'4 d'4 f'4 f'4} }>> \oneVoice |%m74 d'4. 8 8 8 q4 |%m75 } verseA = \lyricmode { re re re mi re fa la la fa mi re so so so re } << \new Staff \with { \xup } << \new Voice = "soprano" { \voiceOne \clors #first #red \SA } >> \new Lyrics \lyricsto "soprano" \verseA >> << \new Staff \with { \xdown } << \new Voice = "soprano" { \voiceOne \clors #first #blue \SA } >> \new Lyrics \lyricsto "soprano" \verseA >>