Re: voice solfege sequence

2014-04-21 Thread Thomas Morley
2014-04-20 23:46 GMT+02:00 MING TSANG tsan...@rogers.com:

 Thank you for modify the solfege-engraver.
 I copy and paste into the .ly file and ran.  Result: The below staff seems
 working, but \xup suppose to put the solfege above staff and now it is put
 below the staff instead - and the stacking is not right.  Any idea?

Hi Ming,

I can't reproduce the image you posted.
On my machine, the attached code returns the attached image.
Please tell me whats wrong with it.

Cheers,
  Harm
\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 c''e''8 b' d''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. g'b'8 f'b'8 g'b'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

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: voice solfege sequence

2014-04-21 Thread MING TSANG
Hi, Thomas:
On Monday, April 21, 2014 4:32:34 AM, Thomas Morley thomasmorle...@gmail.com 
wrote:
 
2014-04-20 23:46 GMT+02:00 MING TSANG tsan...@rogers.com:

 Thank you for modify the solfege-engraver.
 I copy and paste into the .ly file and ran.  Result: The below staff seems
 working, but \xup suppose to put the solfege above staff and now it is put
 below the staff instead - and the stacking is not right.  Any idea?

Hi Ming,

I can't reproduce the image you posted.
On my machine, the attached code returns the attached image.
Please tell me whats wrong with it.

Cheers,

  Harm


Thank you for the attachments.  I desk check your .ly file with my .ly file and 
discover my f.ly file miss the following line:
  (set! (ly:grob-property newgrob 'direction) dir)  
After I copy and paste the line to my .ly file, it works.  Thank you very much.
BTW can the notehead color be retained to show on solfege above the staff?  
Emmanuel,
Ming___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: voice solfege sequence

2014-04-21 Thread Thomas Morley
2014-04-21 13:47 GMT+02:00 MING TSANG tsan...@rogers.com:
 Hi, Thomas:
 On Monday, April 21, 2014 4:32:34 AM, Thomas Morley
 thomasmorle...@gmail.com wrote:
 2014-04-20 23:46 GMT+02:00 MING TSANG tsan...@rogers.com:

 Thank you for modify the solfege-engraver.
 I copy and paste into the .ly file and ran.  Result: The below staff seems
 working, but \xup suppose to put the solfege above staff and now it is
 put
 below the staff instead - and the stacking is not right.  Any idea?

 Hi Ming,

 I can't reproduce the image you posted.
 On my machine, the attached code returns the attached image.
 Please tell me whats wrong with it.

 Cheers,

   Harm

 Thank you for the attachments.  I desk check your .ly file with my .ly file
 and discover my f.ly file miss the following line:
   (set! (ly:grob-property newgrob 'direction) dir)  
 After I copy and paste the line to my .ly file, it works.  Thank you very
 much.
 BTW can the notehead color be retained to show on solfege above the staff?

Should work if you comment
(ly:event-set-property! event-copy 'tweaks '())

(not tested, thogh)

 Emmanuel,
 Ming



___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: voice solfege sequence

2014-04-21 Thread MING TSANG
Hi, Thomas,

On Monday, April 21, 2014 10:17:36 AM, Thomas Morley thomasmorle...@gmail.com 
wrote:
 
2014-04-21 13:47 GMT+02:00 MING TSANG tsan...@rogers.com:
 Hi, Thomas:
 On Monday, April 21, 2014 4:32:34 AM, Thomas Morley
 thomasmorle...@gmail.com wrote:
 2014-04-20 23:46 GMT+02:00 MING TSANG tsan...@rogers.com:

 Thank you for modify the solfege-engraver.
 I copy and paste into the .ly file and ran.  Result: The below staff seems
 working, but \xup suppose to put the solfege above staff and now it is
 put
 below the staff instead - and the stacking is not right.  Any idea?

 Hi Ming,

 I can't reproduce the image you posted.
 On my machine, the attached code returns the attached image.
 Please tell me whats wrong with it.

 Cheers,

   Harm

 Thank you for the attachments.  I desk check your .ly file with my .ly file
 and discover my f.ly file miss the following line:
   (set! (ly:grob-property newgrob 'direction) dir)  
 After I copy and paste the line to my .ly file, it works.  Thank you very
 much.
 BTW can the notehead color be retained to show on solfege above the staff?

Should work if you comment
(ly:event-set-property! event-copy 'tweaks '())

(not tested, thogh)


 Emmanuel,
 Ming




Yes, it works. Thank you.
Emmanuel,
Ming.___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: voice solfege sequence

2014-04-20 Thread Thomas Morley
2014-04-20 3:23 GMT+02:00 Thomas Morley thomasmorle...@gmail.com:
 2014-04-19 23:25 GMT+02:00 MING TSANG tsan...@rogers.com:
 The color solfege will be showing on the lower
 stack in both case.

 I found no convincing method to set the color for the TextScript, though.
 I used a workaround, hoping someone else comes up with a better solution.

Hi again,

I found a way to clear the 'tweaks for newgrob:

#(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))
  (newgrob-cause (ly:grob-property newgrob 'cause))
  (newgrob-tweaks (ly:event-property newgrob-cause 'tweaks)))

 ;; 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) )

HTH,
  Harm

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: voice solfege sequence

2014-04-20 Thread Thomas Morley
2014-04-20 14:30 GMT+02:00 Thomas Morley thomasmorle...@gmail.com:
 2014-04-20 3:23 GMT+02:00 Thomas Morley thomasmorle...@gmail.com:
 2014-04-19 23:25 GMT+02:00 MING TSANG tsan...@rogers.com:
 The color solfege will be showing on the lower
 stack in both case.

 I found no convincing method to set the color for the TextScript, though.
 I used a workaround, hoping someone else comes up with a better solution.

 Hi again,

 I found a way to clear the 'tweaks for newgrob:

 #(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))

Please delete the following two lines:

   (newgrob-cause (ly:grob-property newgrob 'cause))
   (newgrob-tweaks (ly:event-property newgrob-cause 'tweaks))

)

  ;; 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) )

 HTH,
   Harm

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: voice solfege sequence

2014-04-20 Thread MING TSANG
Hi, Thomas:
On Sunday, April 20, 2014 8:36:04 AM, Thomas Morley thomasmorle...@gmail.com 
wrote:
 
2014-04-20 14:30 GMT+02:00 Thomas Morley thomasmorle...@gmail.com:
 2014-04-20 3:23 GMT+02:00 Thomas Morley thomasmorle...@gmail.com:
 2014-04-19 23:25 GMT+02:00 MING TSANG tsan...@rogers.com:
 The color solfege will be showing on the lower
 stack in both case.

 I found no convincing method to set the color for the TextScript, though.
 I used a workaround, hoping someone else comes up with a better solution.

 Hi again,

 I found a way to clear the 'tweaks for newgrob:

 #(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))

Please delete the following two lines:


               (newgrob-cause (ly:grob-property newgrob 'cause))
               (newgrob-tweaks (ly:event-property newgrob-cause 'tweaks))

)

          ;; 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) )

 HTH,
   Harm


Thank you for modify the solfege-engraver.  
I copy and paste into the .ly file and ran.  Result: The below staff seems 
working, but \xup suppose to put the solfege above staff and now it is put 
below the staff instead - and the stacking is not right.  Any idea?

Emmanuel,
Ming.\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))
  (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)))
 (if (string= name Hb)  (set! name B))
 (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 {..}

Re: voice solfege sequence

2014-04-19 Thread Thomas Morley
2014-04-19 23:25 GMT+02:00 MING TSANG tsan...@rogers.com:
 Hi, lilyponders:
 The attach .ly file show the sequencing of solfege above the staff behaves
 inconsistent.
 How can this be resolved?  I am also hoping it will be the same if it is
 sequencing below the staff. The color solfege will be showing on the lower
 stack in both case.
 Help is appreciated.
 Emmanuel,
 Ming



Hi Ming,

the solfege-engraver creates a new TextScript-grob, I think the
properties are (partly) taken from the NoteHead.
Meaning that color persists in some cases and, if the NoteHeads part
of a chord, two TextSript-grobs are created with the same
outside-staff-priority. How they are printed is more or less
unpredictable.

Below I try to assign each Textscript a different
outside-staff-priority according to the staff-position of the
NoteHead.
I found no convincing method to set the color for the TextScript, though.
I used a workaround, hoping someone else comes up with a better solution.

#(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))
  (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)))

 (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)
   ;; Ugh, color is taken from grob in some cases.
   ;; How to clear for newgrob?
   ;; workaround:
   (markup #:with-color black name))
 (set! (ly:grob-property newgrob 'direction) dir) )

HTH,
  Harm

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user