Welcome | Get started | Dive | Contribute | Topics | Reference | Changes | More
songs : Generate music scores using Lilypond¶
Adds database models and functionality to manage songs.
This document assumes you have read The songs plugin.
This page contains code snippets (lines starting with >>>), which are
being tested during our development workflow. The following
snippet initializes the demo project used throughout this page.
>>> from lino_book.projects.noi2.startup import *
Installation¶
If you want Lino to publish .wav files of your songs, you need to
install the midi2audio Python
package, which requires the fluidsynth system
package (which in turn requires two soundfont packages):
$ sudo apt-get install fluidsynth fluid-soundfont-gs fluid-soundfont-gm
$ pip install midi2audio
Demo data¶
The plugin adds some songs as demo data in order to demonstrate what it can do.
>>> rt.show('songs.Songs')
==== ====================================== ==========
ID Title Language
---- -------------------------------------- ----------
2 Ligidal on Jumal Estonian
3 Dans sa maison French
4 Põdral maja Estonian
5 Wer nur den lieben Gott lässt walten German
6 Kes Jumalat nii laseb teha Estonian
==== ====================================== ==========
Lyrics¶
The logic for multiple verses is implemented by the text2lyrics()
function, which used in the *.jinja.ly templates.
Examples:
>>> from lino_xl.lib.songs.models import text2lyrics
>>> txt = """
... - # Si- nu sõ- na lamp on, lamp on,
... - * Sa- na si on lamp- pu, lamp- pu,
... """
>>> pprint(list(text2lyrics(txt)))
[('alt', None, 'Sa- na si on lamp- pu, lamp- pu,')]
>>> pprint(list(text2lyrics("""- first verse\n- second verse""")))
[('std', None, 'first verse\n'), ('std', None, 'second verse')]
>>> pprint(list(text2lyrics("""- main text\n- * alt text""")))
[('std', None, 'main text\n'), ('alt', None, 'alt text')]
>>> pprint(list(text2lyrics("""- main text\n- *+ alt text""")))
[('std', None, 'main text\n'), ('alt', 'SA', 'alt text')]
Reference¶
- *.jinja.ly`¶
Template file used by Song.build_content() to make the input file for
Lilypond.