A music expression can be transposed with \transpose. The
syntax is
\transpose from to musicexpr
This means that musicexpr is transposed by the interval between
the pitches from and to: any note with pitch from
is changed to to.
For example, consider a piece written in the key of D major. If this piece is a little too low for its performer, it can be transposed up to E major with
\transpose d e ...
Consider a part written for violin (a C instrument). If this part is to be played on the A clarinet, the following transposition will produce the appropriate part
\transpose a c ...
\transpose distinguishes between enharmonic pitches: both
\transpose c cis or \transpose c des will transpose up
half a tone. The first version will print sharps and the second
version will print flats
mus = { \key d \major cis d fis g }
\context Staff {
\clef "F" \mus
\clef "G"
\transpose c g' \mus
\transpose c f' \mus
}
Program reference: TransposedMusic, and UntransposableMusic.
If you want to use both \transpose and \relative,
you must put \transpose outside of \relative, since
\relative will have no effect music that appears inside a
\transpose.
This page is for LilyPond-2.4.5 (stable-branch).