Back to Silas S. Brown's home page

Jianpu in Lilypond

jianpu-ly is a Python program (compatible with both Python 2 and Python 3) that assists with printing jianpu (numbered musical notation) in the GNU Lilypond music typesetter. The jianpu is written on a modified-appearance "stave" in Lilypond, which means Lilypond's typesetting capabilities (lyric spacing, slurs, beams etc) will apply to the jianpu without needing to add a 5-line stave. If you prefer, the generated code for the jianpu stave may also be placed in a score with other types of stave.

Using jianpu-ly requires some technical knowledge. If you don't know what a command line is, what a text editor is, what a directory is or what Python is, then please find out about these things before attempting to use jianpu-ly. It is not an extension to Lilypond front-ends like Frescobaldi; it is a 'preprocessor' that currently requires you to have command-line experience.

For Chinese users, someone has written a Chinese summary of jianpu-ly which looks right. (I would put their name here if I could find it.)

Additionally, David Zhang of Beijing extended this idea into a tighter integration of jianpu with Lilypond, often called jianpu10a.ly, which provides a JianpuStaff that accepts normal Lilypond code and translates it (a bit like Lilypond's TabStaff). His style of jianpu is different from that produced by my jianpu-ly (which also has a different input format).

Download jianpu-ly.py or use pip install jianpu-ly or pipx run jianpu-ly (there's also history on GitHub)

Run jianpu-ly < text-file > ly-file (or jianpu-ly text-files > ly-file)
Text files are whitespace-separated and can contain:

Scale going up1 2 3 4 5 6 7 1'
Accidentals1 #1 2 b2 1
Octaves1,, 1, 1 1' 1''
Shortcuts for 1' and 2'8 9
Percussion beatx
Change base octave< >
Semiquaver, quaver, crotchet (16/8/4th notes)s1 q1 1
Dotted versions of the above (50% longer)s1. q1. 1.
Demisemiquaver, hemidemisemiquaver (32/64th notes)d1 h1
Minims (half notes) use dashes1 -
Dotted minim1 - -
Semibreve (whole note)1 - - -
Time signature4/4
Time signature with quaver anacrusis (8th-note pickup)4/4,8
Key signature (major)1=Bb
Key signature (minor)6=F#
Tempo4=85
LyricsL: here are the syl- la- bles (all on one line)
Lyrics (verse 1)L: 1. Here is verse one
Lyrics (verse 2)L: 2. Here is verse two
Hanzi lyrics (auto space)H: hanzi (with or without spaces)
Lilypond headerstitle=the title (on a line of its own)
Guitar chordschords=c2. g:7 c (on own line)
Fret diagramsfrets=guitar (on own line)
Multiple partsNextPart
Instrument of current partinstrument=Flute (on a line of its own)
Multiple movementsNextScore
Prohibit page breaks until end of this movementOnePage
Suppress bar numbersNoBarNums
Suppress first-line indentNoIndent
Ragged last lineRaggedLast
Old-style time signatureSeparateTimesig 1=C 4/4
Indonesian 'not angka' styleangka
Add a Western staff doubling the tuneWithStaff
Tuplets3[ q1 q1 q1 ]
Grace notes beforeg[#45] 1
Grace notes after1 ['1]g
Grace notes with durationsg[d4d5s6] 1
Simple chords,13'5 1 1b3 1 (chord numbers are sorted automatically)
Da capo1 1 Fine 1 1 1 1 1 1 DC
Repeat (with alternate endings)R{ 1 1 1 } A{ 2 | 3 }
Short repeats (percent)R4{ 1 2 }
Ties (like Lilypond's, if you don't want dashes)1 ~ 1
Slurs (like Lilypond's)1 ( 2 )
Erhu fingering (applies to previous note)Fr=0 Fr=4
Erhu symbol (applies to previous note)souyin harmonic up down bend tilde
Tremolo1/// - 1///5 -
Rehearsal lettersletterA letterB
Multibar restR*8
Dynamics (applies to previous note)\p \mp \f
Other 1-word Lilypond \ commands\fermata \> \! \( \) etc
Text^"above note" _"below note"
Harmonic symbols above main notesHarm: (music) :Harm (main music)
Other Lilypond codeLP: (block of code) :LP (each delimeter at start of its line)
Unicode approximation instead of LilypondUnicode
Ignored% a comment

If you have problems, try a different Lilypond version (works on 2.20, 2.22 and 2.24).


All material © Silas S. Brown unless otherwise stated.