A place to store useful pieces of LilyPond code - custom functions, engravers, hacks, templates, examples etc.

Related tags

snippets
Overview

openLilyLib/snippets

What's this?

What is openLilyLib/snippets? There are two answers to this: it's a repository of LilyPond snippets, and it's part of the https://github.com/openlilylib family of extension packages.

openLilyLib/snippets is maintained by Urs Liska (ul <at> openlilylib <dot> org) and a number of contributors. If not specified otherwise any content in this repository is licensed under the GPL version 3 or later. For any information about usage feel free to post to the lilypond-user mailing list.

https://lists.gnu.org/mailman/listinfo/lilypond-user

The Snippets Repository

Originally this repository began as an extended version of the Lilypond Snippet Repository, a place to store LilyPond tools - snippets, templates, extensions. The main differences to the LSR are:

  • Some things cannot be placed in LSR (multi-file extensions, special scripts).
  • LSR doesn't have tools for collaboration and version control.
  • There is not one LilyPond engine behind the system, so snippets do not necessarily all have to work with the same (sometimes outdated) version.

But maybe the most important difference is that the snippets in this repository are includable. The snippets in the LSR have to be copied over into a user's personal library or documents, while the snippets in openLilyLib/snippets are used by having the library available and referencing the code directly in LilyPond input files.

The openLilyLib Package

But the snippets repository is also a member of the family of openLilyLib packages. In this family it is sort of an exception as different from the other packages the snippets may also be used directly, without making use of the central oll-core package.

[EDIT: Currently openLilyLib is undergoing a fundamental reorganization.
The below README contents is about the
current implementation as a collection of arbitrary snippets.
The new structure as a collection of targeted libraries can be found inside the ly directory.]

Contents and Structure

In general all directories and subdirectories contain snippets or modules. We don't keep a table of contents here (as we are waiting for a documentation system that will do that properly), so in order to find your way around please browse the structure

However, the following directories do not contain modules:

  • fonts
    is a deprecated Python script to install additional notation fonts (probably defunct)
  • fried-library-to-be-sorted
    as the name suggests this is a heap of unsorted stuff, enter at your own risk
  • ly
    contains a number of “old-new-style” packages (see below)
  • meta
  • test

Using this repository

You can view the files in your browser by clicking on their names, and simply copy & paste the code into your editor. Each snippet should contain both an includable .ily file (usually module.ily) and a compilable .ly file (usually example.ly). But the preferred way of using snippets is to “install” it as explained on this Wiki page. The direct link to the ZIP file is here.

For those who don't read manuals (or who are already using openLilyLib):
The referenced installation instruction differs from earlier recommendations how to set up openLilyLib/snippets: the repository may still be saved anywhere on your disk, but we recommend creating a “root” directory for openLilyLib, e.g. ~/openlilylib or C:\openlilylib and placing the repository within that (~/openlilylib/snippets, C.\openlilylib\snippets). It is now this root directory (and not the snippets subdirectory) that should be added to LilyPond's include path. This is to make the snippets repostory consistent with the other openLilyLib packages. Of course this means that the include links for existing documents have to be updated accordingly.

Direct (Standalone) Use

The snippets repository is an exception in the family of openLilyLib packages, as it can be used standalone or as a package. We are heading towards the package approach in general, but for now the standalone use may be the most convenient and quick application for some users.

Basically each snippet contained in this repository is represented by one subdirectory, using a nested structure. For example, everything in the editorial-tools/line-break-marks directory constitutes the snippets.editorial-tools.line-break-marks snippet.

Most snippets are maintained in an includable .ily file with function definitions, which should generally be named module.ily (e.g. editorial-tools/line-break-marks/module.ily). Assuming the recommended set-up of having the openLilyLib root directory in LilyPond's include path this can then be used with:

\include "snippets/editorial-tools/line-break-marks/module.ily"

{
  % use commands defined in the snippet
  R1 \lineBreakMark R1
}

Most snippets also have at least one compilable example file demonstrating its use. This is usually named example.ly. Note that (generally) the example files use the snippet with the package syntax described below but they mostly contain a commented include statement for standalone use.

Usage as openLilyLib Package

While it's perfectly possible to directly include snippets as described above we encourage all users to load them as modules as described on the general Wiki page, using the \loadModule and \loadModules commands.

Note that snippets does not provide any package or module options (yet), and as it doesn't contain top-level modules there is no practical use for the \loadPackage \with { modules = ... } syntax.

Issues
  • Fonts/install script

    Fonts/install script

    Script to manage a local font catalog, keep it in sync with http://fonts.openlilylib.org and update an arbitrary number of local LilyPond installations by adding links to the actual font files inside the LilyPond installation(s).

    For more information on the concept and usage of the script please refer to the README.md file and/or the help with python py/font-install/install-lily-fonts --help

    enhancement 
    opened by uliska 30
  • add the Tablature library

    add the Tablature library

    The first module added is "quarter tones".

    opened by fedelibre 20
  • get-a-tree should be more restricitve

    get-a-tree should be more restricitve

    When using get-a-tree or \getatree (for example when handling openlilylib-options) #f is returned when retrieving a non-existent key or even when trying to access a non-existent alist.

    I was about to handle this in the option handling when I realized that it should be dealt with at the source. Unfortunately the code of get-a-tree is somewhat too cryptic (and undercommented) for me to try fiddling around with it..

    One problem is that assoc-get returns #f for a missing key - which can't be distinguished from an existing key with the value #f.

    I'm not completely sure what this should return, as returning the pair through assoc adds an additional layer of complexity when processing the result. But maybe it's necessary as the ambiguity between #f and #f is not really tolerable.

    enhancement oll (general) 
    opened by uliska 20
  • Testing and continuous integration

    Testing and continuous integration

    Since OpenLilyLib is a collection of interdependent libraries it is important to ensure that changes to one library don't break another one.

    This pull request implements a first stub of testing infrastructure that takes a very simple approach. In the OpenLilyLib directory tree we can have files called .simple-tests whose content list LilyPond files we want to compile, possibly using different LilyPond versions. We then have a script, test/simple_tests.py that looks for these files and compiles them. If the exit code is non-zero, then the test is considered as failed.

    Moreover, this pull request already configures Travis CI, a free continuous integration service tightly integrated with Github, to test OpenLilyLib with LilyPond 2.18.2-1 and 2.19.15-1.

    This is by no means neither perfect nor complete, as a more robust solution will require some Scheme testing library to be included in test files, for instance to handle expected failures. However it can already catch errors like this by trying different versions.

    As @uliska pointed out, another possiblity would be to go for a self-hosted Jenkins server on openlilylib.org . This is another viable option and would allow for far more customization, but I think that for the time being this simple solution will already be useful.

    opened by Cecca 16
  • Jpv/edition engraver

    Jpv/edition engraver

    Allow addressing context with shorter/easier names for edition-engraver mods.

    This allows for using different paths to address a context. If a context \consists \editionEngraver my.tag.path editionMods can be placed with (measure 1, position 0/4) \editionMod target 1 0/4 my.tag.path <mod e.g. \override ...>

    This may apply the mod more than once, as Staff, Voice and other contexts might have the same tag-id!

    The path may now be specified with: .ContextName .ContextId .ContextName.ContextId .ContextName.ContextCounter

    All paths are checked in this order! This might cause performance-slowdown, as these are checked on every timestep ... But it works ;)

    opened by jpvoigt 15
  • Questions about GridLY readme/use

    Questions about GridLY readme/use

    Some questions I get from reading the README in the GridLY library. @Cecca please decide for yourself if you simply want to answer the questions or if you take them as feedback to improve the README.

    Am I right that the grid defined with gridly initially doesn't have anything to do with the score structure LilyPond has? I mean, the grid is "simply" a data store from which one can/has to retrieve the parts that are put into the score?
    If that's true it should be possible to use a GridLY grid in parallel to other music, right? (I'm asking this because I'd like to try to use GridLY to complete "Das trunkne Lied" where all the vocal parts have to be done yet, and GridLY seems nicely to support the lyrics, which would be something to tackle first within our existing approach.)

    I'm not 100% clear about \gridSetStructure. From the comments in the example file this command rather sets defaults than defining the structure of a segment. The only thing matching the name would be the music argument - but this doesn't actually define the structure but only the length.
    I don't see this as a problem, but maybe you should consider renaming the command.

    Am I right that you have to pass a single segment to \gridSetStructure and ' \gridPutMusic(and not a range or'all)?If yes (which makes perfect sense) you should make this clear in the README.

    I'm not clear when you should use or when you can drop \checkGrid.

    \gridTest is cool. But I suggest renaming it because its essence is not testing anything but compiling a segment standalone. Maybe \gridCompileSegment?
    Why does it have to be in the same file as the putMusic command, is that true?
    You should also make clear that it expects a single integer (and not one of the other seg-sel entities).

    I don't see if that's reasonably expectable, but it would be cool to think about a way to let the grid optionally build the \score block automatically, using information from an (extended) \gridInit.

    question GridLY 
    opened by uliska 12
  • Fonts by Abraham

    Fonts by Abraham

    I've added a bunch of new music fonts that are 100% compatible with LilyPond. I've also included stylesheets to make them easier to use via the standard \include statement. I've also added licenses for each font, along with a README wherever I felt it would be useful.

    I removed *.pdf so that I could include some immediately downloadable files for others' reference.

    If you could please review and merge the commits, that would be awesome!

    -Abraham

    opened by tisimst 12
  • Preview mode considerations

    Preview mode considerations

    I've put the stuff discussed by email into a more explicit representation in our repo.

    Best way to check the pull request out is to simply switch to the preview-mode branch and inspect the draft-mode directory.

    opened by uliska 10
  • edition-engraver not doing line breaks properly

    edition-engraver not doing line breaks properly

    I have an SATB score with an interlude staff. I'm trying to use edition-engraver in order to remove \break statements from the music code. The score has parts where SA are singing and TB are not, as well as the reverse. No one sings during the interludes.

    The line breaks work as expected when all staves are visible. However, it does not line break properly when I hide empty staves.

    Any idea why?

    opened by ChrisTrahan 10
  • Well formed commit messages

    Well formed commit messages

    Since OpenLilyLib contains many different libraries and components, it's desirable that commit messages start with a name identifying the component (just like here: eb8f1fcffe3dedcbeb363134408af72a36c86da1).

    However I usually keep forgetting to adhere to such policies, resulting in ill-formed commit messages, just like this one: 3e9c6aaf6411458707b06457d4a7693c28ec9ee6 (sorry about that).

    The following git hook can help getting consistent commit messages

    #!/bin/bash
    #
    #                  Well-formed commit messages hook
    #                  ================================
    #
    # This git hook checks whether the message of the commit is well
    # formed, that is, if it starts with the name of the OpenLilyLib
    # component the commit refers to. Here, component refers either to a
    # library contained in the `ly` directory or to some other part of
    # OpenLilyLib, like `meta`.
    #
    # To make an example, commits relative to GridLY should look like
    #
    #     GridLY: a commit message
    #
    # and commits for ScholarLY should be something loke
    #
    #     ScholarLY: another commit message
    #
    # Once this hook is enabled, it will check commit messages before the
    # commit is finalized. If the commit message does not start with the
    # component name, then the commit is aborted.
    #
    # The behaviour of the hook is controlled via the variable
    # `OLL_COMPONENT`, that can be in one of three states:
    #
    #   - unset: in this case the hook will throw an error, asking the
    #            user to set the variable with
    #
    #                   export OLL_COMPONENT=component_name
    #
    #   - set to "": in this case no check will be performed. So, to
    #                disable the hook, it is sufficient to issue the
    #                following command on the terminal
    #
    #                   export OLL_COMPONENT=""
    #
    #                before doing the commit.
    #
    #   - set to some name: the hook will check that the first line of the
    #                       commit message starts with the right component
    #                       name, followed by a colon.
    #
    # To enable this hook, save this file as ".git/hooks/commit-msg".
    #
    #
    
    
    # The variable OLL_COMPONENT is unset
    if [[ ! ${!OLL_COMPONENT[@]} ]]
    then
        echo >&2 "Before commiting, you should set the OpenLilyLib component"
        echo >&2 "you are working on, by setting the environment variable"
        echo >&2 ""
        echo >&2 "    OLL_COMPONENT"
        echo >&2 ""
        echo >&2 "If you prefer not to have commit messages checked, then"
        echo >&2 "set OLL_COMPONENT to the empty string, with"
        echo >&2 ""
        echo >&2 "    export OLL_COMPONENT=\"\""
        exit 1
    # The variable OLL_COMPONENT is set to the empty string
    elif [[ -z $OLL_COMPONENT ]]
    then
        echo >&2 "Variable OLL_COMPONENT is unset, skipping commit message check"
        exit 0
    # The variable OLL_COMPONENT is set, go on with the check
    else
        head -n 1 "$1" | grep "^$OLL_COMPONENT:" || {
            echo >&2 "[ERROR] Commit aborted."
            echo >&2 "The commit message should start with '$OLL_COMPONENT:'"
            exit 1
        }
    fi
    

    By saving the above code to .git/hooks/commit-msg in the local repository, commits not starting with the value of the OLL_COMPONENT environment variable will be rejected.

    I find this snippet really useful, should we include it in the meta section of OpenLilyLib?

    enhancement wish 
    opened by Cecca 9
  • custom-music-fonts/smufl bravura SVG conversion broken

    custom-music-fonts/smufl bravura SVG conversion broken

    Hi,

    I noticed that the given snippet custom-music-fonts works great for creating a PDF score with Bravura, but SVG is broken. Is there any way to fix it?

    Environment:

    • macOS Mojave (10.14.6)
    • lilypond 2.18.2 (from MacPorts)

    Issue:

    SVG output is broken. Screen Shot 2020-02-20 at 17 17 32 This SVG was rendered on Firefox. It's equivalently broken on Chrome.

    Reproduction step:

    1. Installed the Bravura SVG font in lilypond/2.18.2/fonts/svg
    2. Lilypond input file written (attached as 'test.ly')
    3. Executed lilypond command lilypond -I <snippet-path> -dbackend=svg -o test-bravura test.ly

    I've attached the pdf output as well for reference. bravura-svg.zip

    Thanks in advance

    opened by tehunk 0
  • Update bravura and update glyphnames.json

    Update bravura and update glyphnames.json

    Needed to use some new smufl characters (like metNote16thUp). Replaced glyphnames.json and ran the python script. Updated the bravura files for good measure.

    opened by okhick 0
  • Update Bravura to 1.27

    Update Bravura to 1.27

    I left the folder name unchanged due to compatibility purposes.

    opened by ShikiSuen 1
  • fix dot problem in merge-rests-engraver

    fix dot problem in merge-rests-engraver

    The merge-rests-engraver did not merge the dots of several dotted rests resulting in multiple stacked dots on a single merged rest (cf. #123). This commit fixes the issue by removing the dots from all merged rests except one. Since the engraver only merges rests with the same length, it should not matter which rest keeps the dots, so we take the first.

    opened by chfin 4
  • easy-octaves snippet is broken

    easy-octaves snippet is broken

    /home/uliska/software/lilypond/releases/2.19.60/usr/share/lilypond/current/scm/lily-library.scm:189:24: In expression (f m):
    /home/uliska/software/lilypond/releases/2.19.60/usr/share/lilypond/current/scm/lily-library.scm:189:24: Wrong number of arguments to #<procedure #f (music parser)>
    
    bug 
    opened by uliska 0
  • specific-tools/xelatex-markup-list seems broken

    specific-tools/xelatex-markup-list seems broken

    On my PC the example fails on the XeLaTeX part, but I can't see whether it is related to the snippet or to my installation.

    The log is:

    This is XeTeX, Version 3.14159265-2.6-0.99996 (TeX Live 2016/Debian) (preloaded format=xelatex)
     restricted \write18 enabled.
    entering extended mode
    pdftops: /home/uliska/software/lilypond/releases/2.19.60/usr/lib/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by pdftops)
    pdftops: /home/uliska/software/lilypond/releases/2.19.60/usr/lib/libjpeg.so.62: no version information available (required by /lib/x86_64-linux-gnu/libpoppler.so.64)
    pdftops: /home/uliska/software/lilypond/releases/2.19.60/usr/lib/libtiff.so.5: no version information available (required by /lib/x86_64-linux-gnu/libpoppler.so.64)
    pdftops: /home/uliska/software/lilypond/releases/2.19.60/usr/lib/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by /lib/x86_64-linux-gnu/libpoppler.so.64)
    pdftops: /home/uliska/software/lilypond/releases/2.19.60/usr/lib/libz.so.1: no version information available (required by /lib/x86_64-linux-gnu/libpng16.so.16)
    
    fatal error: cannot find file: `xelatex-20170710145823-1.eps' (load path: `/home/uliska/software/lilypond/releases/2.19.60/usr/share/lilypond/current/fonts/svg/:/home/uliska/software/lilypond/releases/2.19.60/usr/share/lilypond/current/fonts/type1/:/home/uliska/software/lilypond/releases/2.19.60/usr/share/lilypond/current/fonts/otf/:/home/uliska/software/lilypond/releases/2.19.60/usr/share/lilypond/current/scm:/home/uliska/software/lilypond/releases/2.19.60/usr/share/lilypond/current/ps:/home/uliska/software/lilypond/releases/2.19.60/usr/share/lilypond/current/ly:/home/uliska/git/bfsc/projects/fried/das-trunkne-lied:/home/uliska/git/bfsc/projects/fried/das-trunkne-lied/library/ly:/home/uliska/git/bfsc/projects/fried/das-trunkne-lied/library/ly/empty-segments:/home/uliska/git/oll-lib/snippets:/home/uliska/git/oll-lib/snippets/ly:/home/uliska/git/oll-lib:')
    

    The last message is from LilyPond again, but obviously a consequence of the previous fail.

    bug 
    opened by uliska 3
  • general-tools/git-commands broken

    general-tools/git-commands broken

    Compilation fails with

    it: /home/uliska/software/lilypond/releases/2.19.60/usr/lib/libz.so.1: no version
    information available (required by git)
    Result:(3aba7fd )
    fatal error: make-column-markup: Invalid argument in position 1.  
    Expect: markup list, found: "3aba7fd".
    Exited with return code 1.
    
    bug 
    opened by uliska 0
  • add zero width non-joiner between compressed syllables

    add zero width non-joiner between compressed syllables

    Title says it all - AFAIK, no ligatures should be set across boundaries of syllables (e.g., to mention a German example, in "Kaufleute" no fl-ligature should be used).

    opened by akobel 1
  • Added lilydrum definitions from github.com/kastdeur/lilydrum

    Added lilydrum definitions from github.com/kastdeur/lilydrum

    Code for creating scores for pipeband drummers. This involves a right/left distinction based on whether the note is above or below the central line This means for legibility only the central line is printed.

    opened by kastdeur 0
  • Adding a tutorial/minimal working example to help new users?

    Adding a tutorial/minimal working example to help new users?

    Would you consider creating a short tutorial or minimal working example for all us Lilypond n00bs out there (in my case, I still feel like a n00b although I've created several scores within Lilypond)? I've been really exited to try out the different styles (for example Improviso which looks absolutely stunning), but haven't been able to do it.

    I think that there are a lot of potential users like me that are discourages from the library because of the rather high bar of entry, and a simple tutorial (going from downloading the library, placing it in a certain path, writing a minimal working example ly file, and horsing around with the --include commands in the terminal) would probably somewhat alleviate that problem. (I would be willing to contribute with such a tutorial myself if somebody just could give me a few pointers on how to do it.)

    screenshot 2016-09-25 16 17 17 screenshot 2016-09-25 16 18 07
    opened by Speldosa 4
Owner
openlilylib
Community Resources around LilyPond (and LaTeX)
openlilylib
A place to store useful pieces of LilyPond code - custom functions, engravers, hacks, templates, examples etc.

openLilyLib/snippets What's this? What is openLilyLib/snippets? There are two answers to this: it's a repository of LilyPond snippets, and it's part o

openlilylib 102 Jul 10, 2021
Use Lilypond like a boss!

The lyp package index lyp - The Lilypond Swiss Army Knife lyp is an open-source tool that takes the pain out of working with Lilypond. Use packages: I

noteflakes 65 Sep 11, 2021
Frescobaldi LilyPond Editor

README for Frescobaldi Homepage: http://www.frescobaldi.org/ Main author: Wilbert Berendsen Frescobaldi is a LilyPond sheet music text editor. It aims

Frescobaldi 501 Sep 21, 2021
Lilypond music preprocessor

Ripple - DRY for Lilypond Ripple is a small program that helps you generate scores and parts without repeating yourself, performing complex includes o

Sharon Rosner 21 Mar 24, 2020
Music typeset with the Lilypond system

Intro (from long ago) This repo contains sheet music typeset with the Lilypond typesetter. The music chosen is in favour of cello music (mostly chambe

Enthusiastic about  the Cello 95 Sep 15, 2021
Typographic Beat-Oriented Notation for music

tbon Typographic Beat-Oriented Notation for music Tbon aims to be the fastest way to enter pitches, rhythms, meter and dynamic levels from a computer

null 11 Jan 23, 2020
Repository of scores typeset using Lilypond & Ripple

Ciconia's Score Repository This repository contains my edition of works by Bach and other baroque composers typeset using Lilypond and Ripple. Process

Sharon Rosner 17 Aug 15, 2021
A music composition library for Clojure and Clojurescript.

Leipzig A composition library for Clojure and Clojurescript by @ctford. Use Include it as a dependency in your project.clj, along with Overtone: [over

Chris Ford 428 Aug 15, 2021
Beautiful LilyPond scores under free licenses

A project to collect and maintain beautiful LilyPond music scores, and to document LilyPond engraving styles, Scheme programs and templates. You can

Wilbert Berendsen 39 Aug 11, 2021
Baroque music scores, typeset with GNU LilyPond

nénuvar - baroque music scores typeset with GNU LilyPond Available scores: J.B. Lully * La Revente des habits (ballet, LWV05) * Amour malade (ballet

Nicolas Sceaux 36 Aug 29, 2021
LilyPond mini-score engraving and sharing service for musicians.

Tunefl LilyPond mini-score engraving and sharing service for musicians. The live Tunefl service is at tunefl.com. More sleep lost by tiredpixel. Insta

Nic Williams 22 Jun 22, 2020
Javascript audio library for the modern web.

Description howler.js is an audio library for the modern web. It defaults to Web Audio API and falls back to HTML5 Audio. This makes working with audi

James Simpson 19k Sep 15, 2021
Open source sheet music

The Mutopia Project The Mutopia Project offers sheet music based on editions in the public domain. All sheet music is written in LilyPond by volunteer

null 187 Sep 3, 2021
Esoteric Programming Language

ORCΛ Orca is an esoteric programming language designed to quickly create procedural sequencers, in which every letter of the alphabet is an operation,

Hundredrabbits 3.4k Sep 14, 2021
The git repository of the advanced drum machine

Hydrogen drum machine Hydrogen is an advanced drum machine for GNU/Linux, Mac and Windows. It's main goal is to bring professional yet simple and intu

Hydrogen 702 Sep 15, 2021
🎵 Music notation engraving library for MEI with MusicXML and Humdrum support and various toolkits (JavaScript, Python)

Verovio is a fast, portable and lightweight library for engraving Music Encoding Initiative (MEI) digital scores into SVG images. Verovio also contain

RISM Digital Center 426 Sep 22, 2021
Python CD-DA ripper preferring accuracy over speed

Whipper Whipper is a Python 3 (3.6+) CD-DA ripper based on the morituri project (CDDA ripper for *nix systems aiming for accuracy over speed). It star

null 554 Sep 19, 2021
Bule-ish CD ripper

cyanrip Fully featured CD ripping program able to take out most of the tedium. Fully accurate, has advanced features most rippers don't, yet has no bl

Lynne 57 Jun 30, 2021