The LilyPond Snippet Repository ♪♫

What's this? Searching the LSR Browse by date Contributing Snippet database Browsing items 10−19 out of 875

Adding a Special Post Event Function to Implement Precise MIDI Velocity Value Control

This is a small hack to output MIDI file with precise velocity value control. This snippet adds a post event function \vel which enables you to set MIDI velocity value directly on any note event. This is accomplished by overriding score.dynamicAbsoluteVolumeFunction This hack causes some warning messages to show when rendering scores because lilypond cannot find any proper engraver for numeric values which are supposed to be markup objects but this is ignorable.

Adding a Special Post Event Function to Implement Precise MIDI Velocity Value Control

Adding accidentals to a trillspanner

By overriding bound-details, you can insert an accidental after the trill sign in a trillspanner. However, this can look ugly since the accidental isn't aligned. With a few tweaks to the script size and position, you can achieve quite pleasing results.

Adding accidentals to a trillspanner

Adding ambitus per voice

Ambitus can be added per voice. In this case, the ambitus must be moved manually to prevent collisions.

Adding ambitus per voice

Adding an extra staff

An extra staff can be added (possibly temporarily) after the start of a piece.

Adding an extra staff

Adding an extra staff (2)

To add an extra staff after the start of a piece, you can choose between having brackets or braces when you go over a new line:

=> Use PianoStaff instead of StaffGroup or ChoirStaff in the code.

You may wish to remove the clef and not only the key:

=> See both \overrides in the code.

You may wish to remove also the little part of staff at the beginning of the extra staff:

=> Use #'stencil = ##f instead of #'transparent = ##t for both \overrides.

If you want to keep the little beginning of staff, keep at least one #'transparent = ##t.

Adding an extra staff (2)

Adding an extra staff at a line break

When adding a new staff at a line break, some extra space is unfortunately added at the end of the line before the break (to fit in a key signature change, which will never be printed anyway). The workaround is to add a setting of Staff.explicitKeySignatureVisibility as is shown in the example.

Adding an extra staff at a line break

Adding an ottava marking to a single voice

If you have more than one voice on the staff, setting octavation in one voice will transpose the position of notes in all voices for the duration of the ottava bracket. If the ottavation is only intended to apply to one voice, the middleCPosition and ottava bracket may be set explicitly. In this snippet, the bass clef usually has middleCPosition set to 6, six positions above the center line, so in the 8va portion middleCPosition is 7 positions (one octave) higher still.

Adding an ottava marking to a single voice

Adding articulation marks using Scheme (advanced)

Using make-music, you can add various stuff to notes. In this example tenuto lines are added to the notes, and tied notes are disregarded.

Adding articulation marks using Scheme (advanced)

Adding articulation marks using Scheme (simple)

Using make-music, you can add various stuff to notes. In this example staccato dots are added to the notes. For this simple case, it is not necessary to use scm constructs.

Adding articulation marks using Scheme (simple)

Adding articulations from a template

Repeating the same articulations a great number of time can be a bit time-consuming to enter.

The function copyArticulations here, automates the job by copying the articulations from a pattern into your music.

As the music is rarely always the same, a few extra functions can give you some flexibility.

The code of the image below is the following:


  \copyArticulations 
      { c( c) c-. c-. }          %% the pattern
      {                          %% the music
        c16 d e f g a b c b8 a g f
        \notCA e1
        \nSkipArti #2
        r8 d16 e f g a b c8 g e g
        \notCA c,1
      }  

Here, \notCA allows you to keep the music untouched and \nSkipArti #2 skips 2 notes (so 2 articulations) in the pattern.

Download the code of this function here : copyArticulations.ly.

Adding articulations from a template

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