What's this?

Sonata K517 (Domenico Scarlatti)LSR (LilyPond Snippet Repository) is a place where people can contribute their creative ideas for using LilyPond, a fantastic program that typesets beautifully and automagically all kinds of music: these ideas are represented by snippets of LilyPond sources—small examples, short and to the point, that show a particular feature or a hack. For instance, the LilyPond manual is filled with such snippets.

Motivation

The problem with snippets is that, being often clever hacks, they are sometimes realized with tools very far from the original idea. For instance, to position a \fermata sign on a bar line, you use rehearsal marks. This makes it difficult to find how to obtain the effect, even in the manual, because it is described in the chapter on rehearsal marks. However, a search for “fermata last bar” can easily solve the problem.

Often, moreover, snippets can be found on the net. But LilyPond is a language that is compiled to music scores: when one sees a suggestion in a mailing list or in a web page, it takes time even to realize that it could be useful. So we miss useful hints.

The idea of LSR is that you should be able to search for a snippet using its description, but you should be able to scan the results as music. This makes it possible to scan the results much more quickly and naturally.

Snippets are contributed by volunteers. Anybody can add their know-how and, in fact, if you add your knowledge to LSR it might be even easier for you to retrieve it (wait, how was that tweak? in which source file did I use it?). So do not be shy, and contribute your first snippet!

Who owns LSR?

Public DomainYou, me, and everybody. LSR is based on free tools (see the next section) and all the supporting code is free software distributed under the GNU General Public License.

The content of the database is public domain, so you can use it, copy it, modify and redistribute it with no obligation. The database itself can be downloaded, either as a database dump, or as a directory of snippets. You can also download a complete local installation, which will make you able to browse LSR without connecting a server (presently the local installation requires installing Apache Jakarta Tomcat and Velocity).

“Me”? And who are you?

I'm an associate professor at the Università degli Studi di Milano. Have a look at my home page if you want to know more.

How does this work?

Several pieces of free/open-source software make LSR possible. Apache, the well-known web server, serves static content, whereas Apache Jakarta Tomcat serves the Velocity-based servlets that perform the search. The DBMS storing the raw data is MariaDB, but the actual searches are performed by MG4J. A handful of common command-line tools, such as ImageMagick, handle the various graphic conversions. The user interface for editing snippets is courtesy of ERW, a free framework for model-driven development of content-management applications based on PHP.

…did I mention that the scores are engraved by LilyPond?