dovecho / Jianpu

Convert a text-based JIANPU file to Lilypond Code
3 stars 2 forks source link

Solve title singer information #1

Open HowcanoeWang opened 6 years ago

HowcanoeWang commented 6 years ago

@dovecho

The lilypond simply support adding these information, just tying these keywords in the front of text file:

dedication = "献词" 
title = "标题" 
subtitle = "子标题" 
subsubtitle = "子子标题" 
instrument = "乐器" 
composer = "作曲家" 
arranger = "编曲家" 
poet = "诗人" 
meter = "标尺" 
piece = "演奏者" 
opus = "作品" 
copyright = "版权" 
tagline = "品牌" 

image

Also I solved the midi speed control (+ is what I add):

...
inDat = " NextScore ".join(inDat)

+ global speed
+ speed = 84

def getLY(score):
+    global speed
...
                num = [int(s) for s in word if s.isdigit()]
                + speed = int(''.join(map(str,num[1:])))
                word_temp = word[0]
....
                else:
+                    out.append(r'\mark \markup{%s ♩=%s}' % (word.replace("b",r'\simple #"b"').replace("#",r'\simple #"#"'), str(speed)))
            elif '/' in word: # time signature
...
def score_end(**headers):
...
        ret += "}\n"
+    if midi: ret += r"\midi { \context { \Score tempoWholesPerMinute = #(ly:make-moment %s 4)} \tempo 4 = %s }" % (str(speed), str(speed)) # TODO: make this customisable (and/or check how to print BPMs in jianpu)
    else: ret += r"\layout{}"
...

However, the source code very dirty and hard to read rather than edit, it also require deep understanding of Lilypond if we need to add more functions (functions metioned in your "have no idea to solve" part in readme).

So I decide to write a pure python jianpu package which can directly convert txt file to pdf file by PIL image processing package and Tkinter GUI package, also want to support real-time midi play rather than compile the whole music in LilyPond.

ssb22 commented 3 years ago

Upstream jianpu-ly does have more improvements (see #2) but we are up against Lilypond limitations. I was hoping the Lilypond core team would see jianpu-ly and decide to integrate jianpu functionality properly, instead of me having to rely on "hacks" to make it work.

Did you publish your PIL version anywhere? I guess it was a lot of work because you don't get Lilypond's code to do the spacing, lyrics alignment, slurs, etc, so you'd have to code for these yourself (unless you didn't need them in your music)