David,  
Please refer to email below.  Silas has developed a way to generate jianpu. I 
find it duplicate of input - one for jianpu and one for lilypond code.  I asked 
if his code can use lilypond code to generate jianpu and the answer is no.The 
way I see your approach is the same jianpu input and lilypond code input - a 
duplicate effort.
Someone in lilypond community ( couldn't remember who - a few lilyponders ) 
provides a way to generate number notes attach to pitch note.  Please refer to 
attached lilypond file.  The jianpu will adjust to the key signature.  (1) one 
draw back is that I cannot just display jianpu only (2) the number has no beat 
identification (quarter note, eighth note, etc) (3) does not display rest  I am 
not familiarly with scheme so I cannot modify the code. 
Please have a look and see if you can adapt to what you try to accomplish.
Immanuel,Ming.
Re: jianpu (numeric notes) lilypond transcribe?
Silas wrote:
I should point out that Ming Tsang's example PNG (posted on 17 Nov)
was created using my "jianpu in Lilypond" program available at
http://people.ds.cam.ac.uk/ssb22/mwrhome/jianpu-ly.html
but what he wants to ask is "is it possible to do that without
having to type the numbers in manually", i.e. can the jianpu be
automatically generated from normal Lilypond input without having
to input the numbers separately.

My program does not attempt to parse normal Lilypond input because
the syntax is a moving target between Lilypond versions and it's rather
complicated to handle everything.

Moreover, although it's nice to be able to print the jianpu line
along with a 5-line stave, in many cases you actually DON'T want
this: if you know the user of the part ONLY reads jianpu, then
the 5-line stave is just wasting paper and ink; you might as well
put jianpu only, especially if you are printing out 135 songs!
And if you are printing jianpu only, then I find it's quicker to
type in the jianpu numbers myself, instead of going to all the
trouble of coding a 5-line staff that won't actually be printed.

Also, in some music you have to make a human judgment about what to
do with the jianpu, for example if the key changes (you may or may
not get away with changing key in the jianpu; it depends on the
singer/instrument; you might have to write everything relative to
the same key, in which case you have to choose which of the music's
different keys is the "main" one) or if there are chromaticisms
(sometimes it makes sense to rewrite the enharmonics in the jianpu
line, e.g. #5 to b6; there are no fixed rules about this, it's
down to judgment and it can depend on the singer/instrument).
If any program did produce the jianpu numbers completely automatically
then I would want to be able to edit/override them at times.

Of course, if the music is simple (it's in one key with no awkward
chromaticisms) then automatic jianpu should be easier.  If I were
inputting a large number of simple tunes, and I wanted both the music
line and the jianpu line but without having to type everything twice,
I would write myself a simple search/replace script so I can automatically
generate one format from the other (or even use a third format to
generate both).  In this case the translator needs to cope only with
the specific things that I will actually use for this specific input
(it does not have to address the entire Lilypond feature set).
For example, if you are in D major and you specify duration on
every note in Lilypond, just replace d4 -> 1, d8 -> q1, e4 -> 2 etc.

In the general case though, it's going to be hard to automatically
convert normal Lilypond input into jianpu-ly's input (or reproduce
jianpu-ly's work in mainstream Lilypond) although it would be nice.

Meanwhile, at least jianpu-ly does have a few "sanity checks" in
it in case you make a mistake.  It performs barline checks like
Lilypond (and in jianpu-ly they are ERRORS, not warnings, so you
should certainly know if you did something wrong there), and it
should be possible to hear the music played back (although I should
probably implement a "play it in the right key" feature so you can
play it alongside the other stave and check all notes sound the same).

Silas

-- 
Silas S Brown http://people.ds.cam.ac.uk/ssb22



    

  
\version "2.19.18"
\language "english"
%%%%
#(define syllables '("do" "re" "mi" "fa" "so" "la" "ti"))
#(define sylsⓓ '("ⓓ" "ⓡ" "ⓜ" "ⓕ" "ⓢ" "ⓛ" "ⓣ"))
#(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) )))))
%}
#(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) }

%{  %%%%%%%%%%%%%%% sample %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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 c'4 d'4 f'4 f'4 }>> \oneVoice |%m74
  d'4. <g'b'>8 <f'b'>8 <g'b'>8 q4 |%m75
}
soprano = { g'1 |   g'4 g'8.g'16 a'2 |  f'1  }

alto = { e'1 |  e'2 e'2 |  c'1| }

\new Staff \with { \zup
}<<
    \new Voice = "soprano"   { 
      %\override TextScript.outside-staff-priority = 1000
      %\textLengthOn % make room for text!
      \voiceOne \SA
    }
  >>


\new Staff {
  <<
    \new Voice = "soprano" \zup { 
      \override TextScript.outside-staff-priority = 1000
      \textLengthOn % make room for text!
      \voiceOne \soprano
    }
    \new Voice = "alto" \zdown {
      \override TextScript.outside-staff-priority = 1000
      \textLengthOn % make room for text!
      \voiceTwo \alto
    }  
  >>
}
%}
%%%%
\header {
  title = "神大愛"
  subtitle = "God‘s Magnificent Love"
  subsubtitle = "[創 18:14]"
  composer = "曲 詞 : 鄧淑儀 Yvonne Tang"
  % Remove default LilyPond tagline
  tagline = ##f
}

\paper {
  #(set-paper-size "letter")
}

\layout {
  \context {
    \Voice
    \consists "Melody_engraver"
    \override Stem #'neutral-direction = #'()
  }
}

global = {
  \key a \major
  \time 4/4
  \partial 4
  \tempo 4=80
}

chordNames = \chordmode {
  \global
  s4     a1     cs1:m     fs1:m     cs1:m   %m00-04
  s1     cs1:m     b1:m     e1     %m05-08
  a1     cs1:m     fs1:m     cs1:m     %m09-12
  d1     cs1:m     b1:m     e1     %m13-16
  d2/e e2     a1     fs1:m     %m17-19
  d1     e1     a1     fs1:m     %m20-23
  d1     e1     a2.     %m24-26
}

melody =  {
  \global
  <>^\markup{\box\bold"Verse 1"}
  a8 b8 \bar"||" cs'2. b8 cs'8 |%m00-01
  e'2. r8 a8 |%m02
  a'4 fs'4 a8 a4 e'8 |%m03
  cs'2. r8 a8 |\break %m04
  a'8 fs'8~2 r8 a8 |%m05
  fs'8 e'8~2 r8 d'8 |%m06
  cs'8 d'4 16 16 \tuplet 3/2{4 e' cs'} |%m07
  b2. a8 b8 |\break %m08
  <>^\markup{\box\bold"Verse 2"}
  cs'2. b8 cs'8 |%m09
  e'2. r8 a8 |%m10
  a'4 fs'4 e'4. fs'8 |%m11
  e'8 cs'8~2 r8 a8 |\break %m12
  a'8 fs'8~2 r8 a8 |%m13
  fs'8 e'8~2 r8 b8 |%m14
  cs'4. b8 4. fs'8 |%m15
  gs'4. e'8 2~ |\break %m16
  e'2 r8 <>^\markup{\box\bold"Chorus"} e'8 8 a'8 \bar"||" %m17
  b'8 cs''4. r8 e'8 8 a'8 |%m18
  gs'8 fs'4. r8 fs'8 gs'8 a'8 |\break %m19
  e''8 d''8~2 a'8 b'8 |%m20
  a'8 gs'4. r8 e'8 8 a'8 |%m21
  b'8 cs''4. r8 e''8 a'8 8 |%m22
  gs'8 fs'8~2 e''8 cs''8 |\break %m23
  d''2 r8 fs'8 cs''8 d''8 |%m24
  b'2 \tuplet 3/2{gs'4 a'4 4} |%m25
  a'2. \bar"|." %m026
  \label #'lastPage 
}

verse = \lyricmode {
  我 唱 出, 神 大 愛, 神 豈 有 難 成 的 事. 人
  生 路, 常 起 跌, 祢 話 語 叫 我 永 不 動 搖. 在 世
  間, 能 遇 祢, 迷 了 路 有 主 引 導. 常
  施 恩, 常 看 顧, 祢 扙 扶 持, 祢 竿 引 領.
  何 時 我 跌 倒, 何 時 祢 扶 持, 危 難 遇
  風 雪, 祢 必 庇 佑, 前 途 在 祢 手, 牽 我 到 白 頭, 守 護
  我, 從 今 天 起, 直 到 永 遠.
  
}

\score {
  <<
    \new ChordNames \chordNames
    \new Staff \ndown { \melody }
    \addlyrics { \verse }
  >>
  \layout {
     \context {
    \Score
    \remove "Bar_number_engraver"
     }
  \context {
    \Staff
    \remove "Time_signature_engraver"
    \remove "Bar_engraver"
  }
  }
  \midi { }
}
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to