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 138<br />

(string?)<br />

#{ ^\markup \bold \box #string #})<br />

\relative c'' {<br />

\tempo 4=50<br />

a4.\mpdolce d8 cis4--\glissando a |<br />

b4 bes a2 |<br />

\inst "Clarinet"<br />

cis4.\< d8 e4 fis |<br />

g8(\! fis)-. e( d)-. cis2 |<br />

}<br />

<br />

<br />

<br />

mp dolce<br />

= 50<br />

<br />

<br />

<br />

<br />

Clarinet<br />

<br />

Let’s do something about the mpdolce and inst definitions. They produce the output we<br />

desire, but we might want to use them in another piece. We could simply copy-and-paste them<br />

at the top of every file, but that’s an annoyance. It also leaves those definitions in our input<br />

files, and I personally find all the #() somewhat ugly. Let’s hide them in another file:<br />

%%% save this to a file called "definitions.ily"<br />

mpdolce =<br />

#(make-dynamic-script<br />

#{ \markup { \hspace #0<br />

\translate #'(5 . 0)<br />

\line { \dynamic "mp"<br />

\text \italic "dolce" } }<br />

#})<br />

inst =<br />

#(define-music-function<br />

(parser location string)<br />

(string?)<br />

#{ ^\markup \bold \box #string #})<br />

We will refer to this file using the \include command near the top of the music file. (The<br />

extension ‘.ily’ is used to distinguish this included file, which is not meant to be compiled on<br />

its own, from the main file.) Now let’s modify our music (let’s save this file as ‘music.ly’).<br />

\include "definitions.ily"<br />

\relative c'' {<br />

\tempo 4=50<br />

a4.\mpdolce d8 cis4--\glissando a |<br />

b4 bes a2 |<br />

\inst "Clarinet"<br />

cis4.\< d8 e4 fis |<br />

g8(\! fis)-. e( d)-. cis2 |<br />

}

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

Saved successfully!

Ooh no, something went wrong!