Jump to content

Customising note heads: Difference between revisions

From LilyPond wiki
m Replace version="2.24.0" with version="2.24" now that the LilyWiki extension supports auto-selecting the latest release in a stable series
m New category
Tags: Mobile edit Mobile web edit
 
(One intermediate revision by the same user not shown)
Line 31: Line 31:
[[Category:Tweaks and overrides]]
[[Category:Tweaks and overrides]]
[[Category:Really simple]]
[[Category:Really simple]]
[[Category:Snippet]]

Latest revision as of 23:17, 21 November 2025

There are two things you need to do to create arbitrary noteheads:

1. change the NoteHead stencil to the text-interface.

2. define the text attribute of the NoteHead. It accepts any markup. The easiest thing to do is to simply call a musicglyph, as in this example.

\version "2.24"

%% http://lsr.di.unimi.it/LSR/Item?id=475

%LSR This snippet was contributed by Victor Adan

headCircle   = {
\once \override NoteHead.stencil = #ly:text-interface::print
\once \override NoteHead.text = #(markup #:musicglyph "scripts.flageolet" ) }

headPlus        = {
\once \override NoteHead.stencil = #ly:text-interface::print
\once \override NoteHead.text = #(markup #:musicglyph "scripts.stopped") }

{
  \headCircle
  c'4
  \headPlus
  d'4
  % normal
  e'4
}