29.11.2012 Views

mpdolce - LilyPond

mpdolce - LilyPond

mpdolce - LilyPond

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 4: Tweaking output 82<br />

presenting examples of how it is used. Here is a simple example to change the color of the note<br />

head:<br />

c d<br />

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

e f g<br />

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

a b c<br />

� � �<br />

� � � �<br />

\revert command<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<br />

be 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 />

c d<br />

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

e f g<br />

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

a<br />

\revert NoteHead #'color<br />

b c<br />

�<br />

\once prefix<br />

� �<br />

� � � �<br />

�<br />

�<br />

�<br />

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

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

before the property reverts back to its default value. Using the same example, we can change<br />

the color of a single note like this:<br />

c d<br />

\once \override NoteHead #'color = #red<br />

e f g<br />

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

a b c<br />

� �<br />

� � � � � �<br />

�<br />

\overrideProperty command<br />

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

Saved successfully!

Ooh no, something went wrong!