Hi all, 
I further reduce the code to 53 lines.  line 4 - 20 & line 24 - 40  are 
identical except line 14 vs line  34.   The actual code for notes is only 8 
lines ( 45 - 52).  I think I cannot reduce anymore in order to show my problem 
and request.
Again  to ask:
problem 1: I am expecting all numbers (jianpu) on top of the letters (solfege) 
- on bar 1 and bar 3 they are reversed; is it possible to solve?
request 2: Is it possible to combine lins 4-20 & lines 24-40 into one define 
variable so that line 14 and line 34 can be access by parameter or by if 
statement?
Emmanuel,
Ming.



On Tuesday, February 11, 2014 5:00:02 PM, David Nalesnik 
<david.nales...@gmail.com> wrote:
 
Hi,



On Tue, Feb 11, 2014 at 3:35 PM, Phil Holmes <m...@philholmes.net> wrote:

 
>OK - so this "tiny" example is 107 lines of 
code.  
>  
>----- Original Message ----- 
>>From: MING TSANG 
>>To: -Eluze ; lilypond-user mailinglist 
>>Sent: Tuesday, February 11, 2014 9:07  PM
>>Subject: Re: consolidate code
>>
>>
>>From: Eluze 
>>Subject: Re: consolidate code 
>>Date: Tue, 11 Feb 2014 11:57:54 -0800 (PST) 
>>________________________________
>> 
>>MING TSANG wrote
>I hope the attached .ly file qualifies as tiny snippet. >>certainly not - 
>please reduce it to one or two notes to show the >>unexpected
>>behavior, and define clearly what you'd expect!
In this case, I think that there might be a misunderstanding.  Cutting the 
example down further wouldn't convey one of the problems the OP is having, I 
think.  Namely, that the .ly file contains a function which he has had to 
repeat several times for the sake of tiny modifications.  He's wondering if it 
can be expressed more simply as a function that takes arguments to cut down on 
the repetition.

Unfortunately, I'm not at a machine where I can help at the moment.

Best,
David 

P.S. @Ming: I found the source of your code very rapidly with a simple search: 
http://www.mail-archive.com/lilypond-user@gnu.org/msg73062.html
\version "2.19.2"


  %\include "include_solfege.ly"      %  \new Satff \with { \consists | #solfegeUP  | #solfegeU  |  #solfegeDOWNN  | #solfegeD   }  OR  \zup \xup xdown zdown
solfegeUP = #(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 '("do" "re" "mi" "fa" "so" "la" "ti") 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) UP) ))))

xup=\with { \consists #solfegeUP }





%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%  \include "include_numbrs.ly"     %   \new Staff \with { \consists #numbrUP }    #nmubrDOWN   OR  \nup   \ndown 
numbrUP = #(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 '("1" "2" "3" "4" "5" "6" "7") 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) UP) ))))


nup=\with { \consists #numbrUP }


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


soprano = {  g'1 |   g'4 g'8.g'16 a'2 |  f'1  }
alto = {  e'1 |  e'2 e'2 |  c'1|}
\new Staff {
  <<
    \new Voice = "soprano"  \xup   {   \voiceOne   \soprano  }
    \new Voice = "alto"  \nup { \voiceTwo   \alto  }  
  >>
}

Attachment: test_num-solfege(2).pdf
Description: Adobe PDF document

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

Reply via email to