Changes

Jump to navigation Jump to search
2,738 bytes added ,  14:58, 30 May 2011
\stoplilypond
</texcode>
 
Here's an example of placing score snippets in the body of the text, with fonts in the score & body matching:
 
<texcode>
\unprotect
 
\usemodule[filter]
 
\traceexternalfilters
 
\defineexternalfilter
[lilypond]
[\c!output=\externalfilterbasefile.pdf,
\c!filtercommand=\lilypondcommand,
\c!continue=\v!yes,
\c!readcommand=\readlilypondoutput,
%\c!directory=output,
]
 
% frame=on is for testing
\def\readlilypondoutput#1{\setupfloats[location=right,frame=off]\placefigure[]{From \sc{http://lsr.dsi.unimi.it/LSR/Search?q=piano}}{\externalfigure[#1]}}
 
\def\lilypondcommand%
{lilypond -dbackend=eps -dno-gs-load-fonts -dinclude-eps-fonts \externalfilterinputfile}
\protect
 
\setuplayout[textwidth=6in] % matches line-width below
\usetypescript[palatino]
\setupbodyfont[palatino,13pt]
 
\starttext
 
\input zapf
 
\startlilypond
\layout{
indent=0\mm
ragged-right = ##f
}
\paper {
myStaffSize = #20
#(define fonts
(make-pango-font-tree "palatino"
"palatino"
"palatino"
(/ myStaffSize 20)))
line-width=6\in
oddFooterMarkup=##f
oddHeaderMarkup=##f
bookTitleMarkup = ##f
scoreTitleMarkup = ##f
}
global = {
\key c \major
\time 4/4
}
 
sopMusic = \relative c'' {
c4 c c8[( b)] c4
}
sopWords = \lyricmode {
hi hi hi hi
}
 
altoMusic = \relative c' {
e4 f d e
}
altoWords =\lyricmode {
ha ha ha ha
}
 
tenorMusic = \relative c' {
g4 a f g
}
tenorWords = \lyricmode {
hu hu hu hu
}
 
bassMusic = \relative c {
c4 c g c
}
bassWords = \lyricmode {
ho ho ho hø
}
 
\score {
<<
\new ChoirStaff <<
\new Lyrics = "sopranos"
\new Staff = "women" <<
\new Voice = "sopranos" { \voiceOne << \global \sopMusic >> }
\new Voice = "altos" { \voiceTwo << \global \altoMusic >> }
>>
\new Lyrics = "altos"
\new Lyrics = "tenors"
\new Staff = "men" <<
\clef bass
\new Voice = "tenors" { \voiceOne << \global \tenorMusic >> }
\new Voice = "basses" { \voiceTwo << \global \bassMusic >> }
>>
\new Lyrics = "basses"
\context Lyrics = "sopranos" \lyricsto "sopranos" \sopWords
\context Lyrics = "altos" \lyricsto "altos" \altoWords
\context Lyrics = "tenors" \lyricsto "tenors" \tenorWords
\context Lyrics = "basses" \lyricsto "basses" \bassWords
>>
\new PianoStaff <<
\new Staff <<
\set Staff.printPartCombineTexts = ##f
\partcombine
<< \global \sopMusic >>
<< \global \altoMusic >>
>>
\new Staff <<
\clef bass
\set Staff.printPartCombineTexts = ##f
\partcombine
<< \global \tenorMusic >>
<< \global \bassMusic >>
>>
>>
>>
}
\stoplilypond
\input zapf
\stoptext
<\texcode>
== Setup ==
2

edits

Navigation menu