The LilyPond Snippet Repository ♪♫

What's this? Searching the LSR Browse by date Contributing Snippet database Browsing items 30−39 out of 838

Adding indicators to staves which get split after a break

This snippet defines the \splitStaffBarLine, convUpStaffBarLine and convDownStaffBarLine commands. These add arrows at a bar line, to denote that several voices sharing a staff will each continue on a staff of their own in the next system, or that voices split in this way recombine.

Adding indicators to staves which get split after a break

Adding instrument name and clef change to cue notes

Lilypond provides the \cueDuring and \transposedCueDuring commands to add cue notes. However, these commands do neither print any cue instrument name, nor do they allow the cue notes to be in a different clef than the quoting voice.

To be able to add cue instrument names and/or clef changes, as a workaround, you can define your own function that sets instrumentCueName and the clef for the staff. At the end of the cue music (typically R1*2), you'll have to reset them again. This snippet combines these steps into one function:

The example also shows how to modify properties of the displayed cue instrument names: They are generated as InstrumentSwitch objects, which support all different kinds of interfaces, like the font-interface to modify font settings.

The disadvantage of this solution is that you always have to manually give the instrument name and clef of the quoting voice, because otherwise the function is not able to reset these. However, there is currently no way known to me how to set the instrument name and clef for a quoted voice automatically.

Adding instrument name and clef change to cue notes

Adding line between fingerings or a glissando between nonadjacent notes

Need a glissando between two nonadjacent notes or a line between two fingerings?

\guide = dashed line.

\gliss = glissando line.

Adding line between fingerings or a glissando between nonadjacent notes

Adding line breaks in MIDI Karaoke lyrics without disrupting printed score

Lyrics can be added with the \addlyrics command, and they will appear in both the layout and midi. The MIDI Karaoke standard allows for the concept of line breaks, usually introduced with either a slash or a backslash at the beginning of a lyric syllable, but placing either of those characters in the lyrics is both messy in the .ly file and disruptive to the printable version (either character will display in the end result).

The perfect solution is to start the lyric syllable with \n - at least, it seems to work with vanBasco's Karaoke Player for Windows (confirmation with other players requested!) However, this is immensely ugly in the LilyPond source:

\addlyrics {
  "\nDoe," a deer, a fe- male deer,
  "\nRay," a drop of gol- den sun,
  "\nMe," a name I call my- self,
  "\nFar," a long long way to run!
}
It's especially ugly if the first word of the line has more than one syllable (the quote in the middle of the word).

With a bit of Scheming, this can be made far cleaner. The function recursively searches its argument for LyricEvents and replaces any leading exclamation mark with a newline.

\addlyrics {
  \lyr {
    !Doe, a deer, a fe- male deer,
    !Ray, a drop of gol- den sun,
    !Me, a name I call my- self,
    !Far, a long long way to run!
  }
}

Adding line breaks in MIDI Karaoke lyrics without disrupting printed score

Adding links to objects

To add a link to a grob-stencil you could use add-link as defined here. Works with \override and \tweak.

Drawback: point-and-click will be disturbed for the linked grobs.

Limitation: Works for PDF only.

The linked objects are colored with a separate command.

Adding links to objects

Adding markups in a tablature

By default markups does not show in a tablature.

To make them appear, simply use the command \revert TabStaff.TextScript.stencil

Adding markups in a tablature

Adding metronome ticks to a piece of music

If you need to produce a piece of music with metronome ticks, optionally only in the midi, you can use this boilerplate code. Note that it sounds nicer than it looks :) .

Adding metronome ticks to a piece of music

Adding notes

A note is printed by specifying its pitch and then its duration.

Adding notes

Adding notes to the notes of a melody

If you want to add notes to the existing notes of a melody (to make chords), you generally have to copy your melody then add lots of <_ to="to" each="each" note="note" which="which" can="can" be="be" a="a" time-consuming.p="time-consuming.p"> The \addNote function here makes it faster and simpler.

The syntax is : \addNote \melody \newNotes

Here :

melody = \relative {c'4.-> d8-. c4(\p b8) r c4\f c c2}

newnotes = {e f e d e s e}

Note that with this function, you can easily create some other useful functions. For example, a function \doubleOctave is shown here. This doubles each note with the note an octave higher.

Adding notes to the notes of a melody

Adding orchestral cues to a vocal score

This shows one approach to simplify adding many orchestral cues to the piano reduction in a vocal score. The music function \cueWhile takes four arguments: the music from which the cue is to be taken, as defined by \addQuote, the name to be inserted before the cue notes, then either #UP or #DOWN to specify either \voiceOne with the name above the staff or \voiceTwo with the name below the staff, and finally the piano music in parallel with which the cue notes are to appear. The name of the cued instrument is positioned to the left of the cued notes. Many passages can be cued, but they cannot overlap each other in time.

Adding orchestral cues to a vocal score

⇦ Previous 1 2 3 4 5 6 7 8 9 10 Next ⇨