What's this? Searching the LSR Browse by date Contributing Snippet database | Browsing items 0−9 out of 935 |
This snippet lets you draw a QR-code, for example to provide a link to the composer's, or the music editor's website.
Actually encoding the URL into a QR-code is not done here (this just draws the QR-code from a grid of "black" or "white" values), but see the code for a short Python snippet you can use to avoid having to fill for each small square if it's black or white.
This snippet is obsolete starting from LilyPond 2.25.3, which adds a \qr-code
markup command that takes a URL directly instead of a grid of "black" and "white" values. It is used like \markup \qr-code #10 "https://lilypond.org"
.
\changePitch
, to repeatedly print a given rhythm with different notes. Its syntax is
\changePitch \pattern \newnotes
This will replace notes in \pattern
by notes in \newnotes
. If the note-count in \newnotes
is greater, the pattern is copied repeatedly. Rests or skips are allowed, and the function also works for chords.
More detailed documentation (in pdf format), and also the most recent "changePitch.ly" can be found here.
A common practice in lead sheets is to abbreviate chord changes when only the bass note is changed. s, Cmaj7, Cmaj7/B
would be written as Cmaj7, /B
, for example. There is no simple way to do this in LilyPond, but it is possible to use a whiteout hack like snippet #309 to accomplish the desired effect.
\combine
command helps, but it can only take two arguments.
The \overlay
-markup command takes a list of markup elements, it becomes much easier to lay out complex markup into specific arrangements, such as tables.
LilyPond currently does not consider simultaneous notes to automatically determine the correct accidentals; it only looks at previous notes and key signatures. As a consequence, it is necessary to do some manual adjustments.
Unfortunately, these adjustments are quite complex. The Scheme code in this snippet provides a new engraver custom_accidental_placement_engraver
that introduces a details
subproperty flag called capture
for the Accidental
grob. If this flag is set, the current voice captures
the accidental so that it is no longer aligned with the other accidentals in a note column. Together with other properties (force-hshift
and ignore-collision
) it is possible to achieve the desired result.
\markup
can be tweaked by changing the
\translate-scaled
arguments. \translate-scaled
is
used here rather than \translate
in order to let the
positioning of the symbol parts adapt to changes of font-size
.