Jump to content

Engravers one by one: Difference between revisions

From LilyPond wiki
No edit summary
m Lemzwerg moved page Engravers one-by-one to Engravers one by one without leaving a redirect
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
The notation problem, creating a certain symbol, is handled by plugins. Each plugin is called an ''engraver''. In this example, (some) engravers are switched on one by one, in the following order:
LilyPond handles the various elements necessary to typeset a score with plugins. Each plugin is called an ''engraver''. In this example, (some) engravers are switched on one by one, in the following order:


- note heads,
* note heads,
 
* staff symbol,
- staff symbol,
* clef,
 
* stem,
- clef,
* beams, slurs, accents,
 
* accidentals, bar lines, time signature, and key signature.
- stem,
 
- beams, slurs, accents,
 
- accidentals, bar lines, time signature and key signature.


Engravers are grouped. For example, note heads, slurs, beams, etc., form a <code>Voice</code> context. Engravers for key signature, accidentals, bar line, etc., form a <code>Staff</code> context.
Engravers are grouped. For example, note heads, slurs, beams, etc., form a <code>Voice</code> context. Engravers for key signature, accidentals, bar line, etc., form a <code>Staff</code> context.


<lilypond version="2.24" full>
<lilypond version="2.24">
\header { tagline = ##f }
 
topVoice = \relative c' {
topVoice = \relative c' {
   \key d \major
   \key d \major
Line 25: Line 18:
   d4->
   d4->
}
}


% empty staff and voice contexts
% empty staff and voice contexts
Line 31: Line 23:
   \type Engraver_group
   \type Engraver_group
   \name Staff
   \name Staff
   \accepts Voice
   \accepts Voice
   \defaultchild Voice
   \defaultchild Voice
Line 39: Line 30:
   \name Voice
   \name Voice
}
}


% add note heads
% add note heads
Line 126: Line 116:
</lilypond>
</lilypond>


[[Category:Contexts and engravers]]
[[Category:Contexts and engravers]]
[[Category:Contexts and engravers]]
[[Category:Specific notation]]
[[Category:Specific notation]]
[[Category:Included in the official documentation]][[Category:Snippet]]
[[Category:Included in the official documentation]]
[[Category:Snippet]]

Latest revision as of 20:35, 16 December 2025

LilyPond handles the various elements necessary to typeset a score with plugins. Each plugin is called an engraver. In this example, (some) engravers are switched on one by one, in the following order:

  • note heads,
  • staff symbol,
  • clef,
  • stem,
  • beams, slurs, accents,
  • accidentals, bar lines, time signature, and key signature.

Engravers are grouped. For example, note heads, slurs, beams, etc., form a Voice context. Engravers for key signature, accidentals, bar line, etc., form a Staff context.

\version "2.24"

topVoice = \relative c' {
  \key d \major
  es8([ g] a[ fis])
  b4
  b16[-. b-. b-. cis-.]
  d4->
}

% empty staff and voice contexts
MyStaff = \context {
  \type Engraver_group
  \name Staff
  \accepts Voice
  \defaultchild Voice
}
MyVoice = \context {
  \type Engraver_group
  \name Voice
}

% add note heads
MyVoice = \context {
  \MyVoice
  \consists Note_heads_engraver
}
\score {
  \topVoice
  \layout {
    \context { \MyStaff }
    \context { \MyVoice }
  }
}

% add staff
MyStaff = \context {
  \MyStaff
  \consists Staff_symbol_engraver
}
\score {
  \topVoice
  \layout {
    \context { \MyStaff }
    \context { \MyVoice }
  }
}

% add clef
MyStaff = \context {
  \MyStaff
  \consists Clef_engraver
}
\score {
  \topVoice
  \layout {
    \context { \MyStaff }
    \context { \MyVoice }
  }
}

% add stems
MyVoice = \context {
  \MyVoice
  \consists Stem_engraver
}
\score {
  \topVoice
  \layout {
    \context { \MyStaff }
    \context { \MyVoice }
  }
}

% add beams, slurs, and accents
MyVoice = \context {
  \MyVoice
  \consists Beam_engraver
  \consists Slur_engraver
  \consists Script_engraver
  \consists Rhythmic_column_engraver
}
\score {
  \topVoice
  \layout {
    \context { \MyStaff }
    \context { \MyVoice }
  }
}

% add accidentals, bar, time signature, and key signature
MyStaff = \context {
  \MyStaff
  \consists Accidental_engraver
  \consists Bar_engraver
  \consists Time_signature_engraver
  \consists Key_engraver
}
\score {
  \topVoice
  \layout {
    \context { \MyStaff }
    \context { \MyVoice }
  }
}