09.09.2013 Views

LilyPond Beginnershandleiding

LilyPond Beginnershandleiding

LilyPond Beginnershandleiding

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Hoofdstuk 4: Tweaking output 90<br />

\override is the most common command used in tweaking, and most of the rest of this<br />

chapter will be directed to presenting examples of how it is used. Here is a simple example to<br />

change the color of the note head:<br />

c4 d<br />

\override NoteHead.color = #red<br />

e4 f |<br />

\override NoteHead.color = #green<br />

g4 a b c |<br />

<br />

<br />

The \revert command<br />

<br />

<br />

<br />

<br />

<br />

<br />

Once overridden, the property retains its new value until it is overridden again or a \revert<br />

command is encountered. The \revert command has the following syntax and causes the value<br />

of the property to revert to its original default value; note, not its previous value if several<br />

\override commands have been issued.<br />

\revert Context.LayoutObject.layout-property<br />

Again, just like Context in the \override command, Context is often not needed. It will be<br />

omitted in many of the following examples. Here we revert the color of the note head to the<br />

default value for the final two notes:<br />

c4 d<br />

\override NoteHead.color = #red<br />

e4 f |<br />

\override NoteHead.color = #green<br />

g4 a<br />

\revert NoteHead.color<br />

b4 c |<br />

<br />

<br />

<br />

<br />

The \once prefix<br />

<br />

<br />

<br />

<br />

Both the \override and the \set commands may be prefixed by \once. This causes the following<br />

\override or \set command to be effective only during the current musical moment before the<br />

property reverts back to its previous value (this can be different from the default if another<br />

\override is still in effect). Using the same example, we can change the color of a single note<br />

like this:<br />

c4 d<br />

\override NoteHead.color = #red<br />

e4 f |<br />

\once \override NoteHead.color = #green<br />

g4 a<br />

\revert NoteHead.color<br />

b c |

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!