The LilyPond Snippet Repository ♪♫

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

Adding extra fingering with Scheme

You can add additional elements to notes using map-some-music. In this example, an extra script is attached to a note.

In general, first do a \displayMusic of the music you want to create, then write a function that will work on the appropriate parts of the music for you.

Adding extra fingering with Scheme

Adding fingerings (or string numbers or stroke fingerings) outside of the music code

The scheme function \addFingering adds fingerings to a music part respecting fingeringOrientations even if single notes are not in chord brackets (<_. p="p"> In the example below, the music code is just set as follow :

    music = \relative c' { 
                c4 d  
                g f  
                c b a b
                1
            }
The fingering code is set in a string parameter :

    \addFingering \music
            #"012345           % mes 1
              xxxx '1-2''3-4'  % mes 2
              -1+2-3+4         % mes 3
              1234             % mes 4
              "

The rules are :

Each digit [0-5] is attached to the corresponding note in the music.

You can use a letter (here x) to skip a note, or if you want to skip n consecutive notes, use the syntax *nx ( for ex *15x will skip 15 notes).

Instead of one digit, you can add a substitution fingering by enclosing several digits between 2 apostrophes, with - (minus) as separator char, like that '1-2-3'.

+ and - (plus/minus) before a digit mean respectively direction UP and DOWN.They override fingeringOrientations set before.

Comments can be added at the end of the line and must start with a percent sign (%).

All other characters not mentioned above are ignored.

Notes :

1-If you are curious to know how to add various \override, you can uncomment the commented lines of the code of this snippet, but you'll need first to download here the file called "extractMusic.ly".

2-You can also use \displayLilyMusic to get single notes with fingering instructions embedded in chord brackets.

3-Two similar functions \addStringNumber and \addStrokeFinger are also provided. You can quickly add by the same way, respectively string numbers and stroke fingerings.

Adding fingerings (or string numbers or stroke fingerings) outside of the music code

Adding fingerings to a score

Fingering instructions can be entered using a simple syntax.

Adding fingerings to a score

Adding fingerings to a score using markup objects

Fingerings can be entered as markup objects, for example to specify fingering changes on a single note.

Adding fingerings to a score using markup objects

Adding fingerings to chords

Fingerings for chords can be obtained by adding them to individual pitches.

Adding fingerings to chords

Adding fingerings to tablatures

To add fingerings to tablatures, use a combination of \markup and \finger.

Adding fingerings to tablatures

Adding indicators to staves which get split after a break

This snippet defines the commands \splitStaffBarLine, \convUpStaffBarLine, and \convDownStaffBarLine. 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

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