LilyPond Beginnershandleiding
LilyPond Beginnershandleiding
LilyPond Beginnershandleiding
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Hoofdstuk 4: Tweaking output 142<br />
standard <strong>LilyPond</strong> predefined commands, such as \stemUp and \slurDotted. You will see that<br />
these are nothing more than definitions of variables containing one or a group of \override<br />
commands. For example, /tieDotted is defined to be:<br />
tieDotted = {<br />
\override Tie.dash-period = #0.75<br />
\override Tie.dash-fraction = #0.1<br />
}<br />
If you do not like the default values these predefined commands can be redefined easily, just<br />
like any other variable, at the head of your input file.<br />
The following are the most useful files to be found in ‘ly/’:<br />
Filename Contents<br />
‘ly/engraver-init.ly’ Definitions of engraver Contexts<br />
‘ly/paper-defaults-init.ly’ Specifications of paper-related defaults<br />
‘ly/performer-init.ly’ Definitions of performer Contexts<br />
‘ly/property-init.ly’ Definitions of all common predefined commands<br />
‘ly/spanner-init.ly’ Definitions of spanner-related predefined commands<br />
Other settings (such as the definitions of markup commands) are stored as ‘.scm’ (Scheme)<br />
files. The Scheme programming language is used to provide a programmable interface into Lily-<br />
Pond internal operation. Further explanation of these files is currently outside the scope of this<br />
manual, as a knowledge of the Scheme language is required. Users should be warned that a<br />
substantial amount of technical knowledge or time is required to understand Scheme and these<br />
files (see Sectie “Scheme tutorial” in Uitbreidingen).<br />
If you have this knowledge, the Scheme files which may be of interest are:<br />
Filename Contents<br />
‘scm/auto-beam.scm’ Sub-beaming defaults<br />
‘scm/define-grobs.scm’ Default settings for grob properties<br />
‘scm/define-markup-commands.scm’ Specify all markup commands<br />
‘scm/midi.scm’ Default settings for MIDI output<br />
‘scm/output-lib.scm’ Settings that affect appearance of frets, colors, accidentals,<br />
bar lines, etc<br />
‘scm/parser-clef.scm’ Definitions of supported clefs<br />
‘scm/script.scm’ Default settings for articulations<br />
4.6.5 Advanced tweaks with Scheme<br />
Although many things are possible with the \override and \tweak commands, an even more<br />
powerful way of modifying the action of <strong>LilyPond</strong> is available through a programmable interface<br />
to the <strong>LilyPond</strong> internal operation. Code written in the Scheme programming language can be<br />
incorporated directly in the internal operation of <strong>LilyPond</strong>. Of course, at least a basic knowledge<br />
of programming in Scheme is required to do this, and an introduction is provided in the Sectie<br />
“Scheme tutorial” in Uitbreidingen.<br />
As an illustration of one of the many possibilities, instead of setting a property to a constant<br />
it can be set to a Scheme procedure which is then called whenever that property is accessed by<br />
<strong>LilyPond</strong>. The property can then be set dynamically to a value determined by the procedure at<br />
the time it is called. In this example we color the note head in accordance with its position on<br />
the staff.<br />
#(define (color-notehead grob)<br />
"Color the notehead according to its position on the staff."<br />
(let ((mod-position (modulo (ly:grob-property grob 'staff-position)