Guide, node Updating translation committishes..
@end ignore
-@c \version "2.19.7"
+@c \version "2.19.22"
@node Changing defaults
@chapter Changing defaults
% musical content
\context Voice = "one" {
- \relative c'' {
- c4 c c c
+ \relative {
+ c''4 c c c
}
}
\context Voice = "two" {
- \relative c'' {
- g8 g g4 g g
+ \relative {
+ g'8 g g4 g g
}
}
>>
% musical content
\context Voice = "one" {
- \relative c'' {
- c4 c c c
+ \relative {
+ c''4 c c c
}
}
\context Voice = "two" {
- \relative c'' {
- g8 g g4 g g
+ \relative {
+ g'8 g g4 g g
}
}
>>
@code{\applyContext} is executed:
@example
-\new Staff \relative c' @{
- c1
+\new Staff \relative @{
+ c'1
\context Timing
\applyContext #(lambda (ctx)
(newline)
in this way for the duration of the piece:
@lilypond[quote,verbatim]
-musicA = \relative c'' { d4 d d d }
-musicB = \relative c'' { g4 g g g }
+musicA = \relative { d''4 d d d }
+musicB = \relative { g'4 g g g }
keepVoicesAlive = {
<<
\new Voice = "A" { s1*5 } % Keep Voice "A" alive for 5 bars
sections, of course.
@lilypond[quote,verbatim]
-melody = \relative c'' { a4 a a a }
-accompaniment = \relative c' { d4 d d d }
+melody = \relative { a'4 a a a }
+accompaniment = \relative { d'4 d d d }
words = \lyricmode { These words fol -- low the mel -- o -- dy }
\score {
<<
line it up correctly with the accompaniment:
@lilypond[quote,verbatim]
-melody = \relative c'' {
+melody = \relative {
s1 % skip a bar
- a4 a a a
+ a'4 a a a
s1 % skip a bar
a4 a a a
}
-accompaniment = \relative c' {
- d4 d d d
+accompaniment = \relative {
+ d'4 d d d
d4 d d d
d4 d d d
d4 d d d
\consists "Timing_translator"
\consists "Default_bar_line_engraver"
}
- \relative c'' {
+ \relative {
\time 3/4
- c4 c c c c c
+ c''4 c c c c c
}
\new Staff \with {
\consists "Timing_translator"
\consists "Default_bar_line_engraver"
}
- \relative c'' {
+ \relative {
\time 2/4
- c4 c c c c c
+ c''4 c c c c c
}
>>
\layout {
@lilypond[quote,verbatim]
\score {
- \relative c'' {
- a4^"Thicker stems" a a a
+ \relative {
+ a'4^"Thicker stems" a a a
a4 a a\ff a
}
\layout {
@lilypond[quote,verbatim]
\score {
- \relative c'' {
- a4^"Smaller font" a a a
+ \relative {
+ a'4^"Smaller font" a a a
a4 a a\ff a
}
\layout {
@lilypond[quote,verbatim]
\score {
- \relative c'' {
- a4^"Dynamics above" a a a
+ \relative {
+ a'4^"Dynamics above" a a a
a4 a a\ff a
}
\layout {
\score {
\new Staff {
- \relative c'' {
- a4^"Smaller font" a a a
+ \relative {
+ a'4^"Smaller font" a a a
a4 a a a
}
}
@lilypond[quote,verbatim]
\score {
\new Staff {
- \relative c'' {
- a4^"Smaller font" a a a
+ \relative {
+ a'4^"Smaller font" a a a
a4 a a a
}
}
\new Staff {
\new Voice \with { \override Stem.thickness = #4.0 }
{
- \relative c'' {
- a4^"Thick stems" a a a
+ \relative {
+ a'4^"Thick stems" a a a
a4 a a a
}
}
\score {
<<
\new Staff {
- \relative c'' {
- a4^"Default font" a a a
+ \relative {
+ a'4^"Default font" a a a
a4 a a a
}
}
\new Staff \with { fontSize = #-4 }
{
- \relative c'' {
- a4^"Smaller font" a a a
+ \relative {
+ a'4^"Smaller font" a a a
a4 a a a
}
}
<<
\new Staff {
\new Voice {
- \relative c'' {
- a4^"Dynamics below" a a a
+ \relative {
+ a'4^"Dynamics below" a a a
a4 a a\ff a
}
}
{
\new Voice \with { \dynamicUp }
{
- \relative c'' {
- a4^"Dynamics above" a a a
+ \relative {
+ a'4^"Dynamics above" a a a
a4 a a\ff a
}
}
\accepts "ImproVoice"
}}
-\relative c'' {
- a4 d8 bes8 \new ImproVoice { c4^"ad lib" c
+\relative {
+ a'4 d8 bes8 \new ImproVoice { c4^"ad lib" c
c4 c^"undress" c_"while playing :)" c }
a1
}
Then the output at the start of this subsection can be entered as
@example
-\relative c'' @{
- a4 d8 bes8
+\relative @{
+ a'4 d8 bes8
\new ImproVoice @{
c4^"ad lib" c
c4 c^"undress"
@lilypond[quote,relative=2,verbatim]
c-2
-\stemUp
-f
@end lilypond
If you visit the documentation on fingering instructions (in
@lilypond[quote,relative=2,verbatim]
c-2
-\stemUp
-f
@end lilypond
Since the @b{2} is vertically positioned next to its note, we have to
@lilypond[quote,relative=2,verbatim]
\once \override Voice.Fingering.padding = #3
c-2
-\stemUp
-f
@end lilypond
@lilypond[verbatim,quote,relative=2]
a1
-\compressFullBarRests
-R1*23
-% increase the length of the rest bar
-\once \override MultiMeasureRest.minimum-length = #20
-R1*23
-a1
+\compressMMRests {
+ R1*23
+ % increase the length of the rest bar
+ \once \override MultiMeasureRest.minimum-length = #20
+ R1*23
+ a1
+}
@end lilypond
@lilypond[verbatim,quote,relative=2]
\musicglyph #"noteheads.s2cross"
}
}
-\relative c'' {
- a a \XinO a a
+\relative {
+ a' a \XinO a a
}
@end lilypond
the spacing engine knows the width of the note heads and avoids the
collision by lengthening the line accordingly.
-Usually for simple calculations nearly-identical functions for both the
-@q{unpure} and @q{pure} parts can be used, by only changing the number
-of arguments passed to, and the scope of, the function.
+Usually for simple calculations nearly-identical functions for
+both the @q{unpure} and @q{pure} parts can be used, by only
+changing the number of arguments passed to, and the scope of, the
+function. This use case is frequent enough that
+@code{ly:make-unpure-pure-container} constructs such a second
+function by default when called with only one function argument.
@warning{If a function is labeled as @q{pure} and it turns out not to
be, the results can be unexpected.}
@example
function =
#(define-music-function
- (parser location @var{arg1} @var{arg2} @dots{})
+ (@var{arg1} @var{arg2} @dots{})
(@var{type1?} @var{type2?} @dots{})
#@{
@var{@dots{}music@dots{}}
(eg. @samp{#arg1}).
@end multitable
-The @code{parser} and @code{location} arguments are mandatory, and
-are used in some advanced situations as described in the
-@q{Extending} manual (see @rextend{Music functions}). For
-substitution functions, just be sure to include them.
-
-The list of type predicates is also required. Some of the most
-common type predicates used in music functions are:
+The list of type predicates is required. Some of the most common
+type predicates used in music functions are:
@example
boolean?
@lilypond[quote,verbatim,ragged-right]
padText =
#(define-music-function
- (parser location padding)
+ (padding)
(number?)
#{
\once \override TextScript.padding = #padding
#})
-\relative c'' {
- c4^"piu mosso" b a b
+\relative {
+ c''4^"piu mosso" b a b
\padText #1.8
c4^"piu mosso" b a b
\padText #2.6
@lilypond[quote,verbatim,ragged-right]
custosNote =
#(define-music-function
- (parser location note)
+ (note)
(ly:music?)
#{
\tweak NoteHead.stencil #ly:text-interface::print
#note
#})
-\relative c' { c4 d e f \custosNote g }
+\relative { c'4 d e f \custosNote g }
@end lilypond
Substitution functions with multiple arguments can be defined:
@lilypond[quote,verbatim,ragged-right]
tempoPadded =
#(define-music-function
- (parser location padding tempotext)
+ (padding tempotext)
(number? markup?)
#{
\once \override Score.MetronomeMark.padding = #padding
\tempo \markup { \bold #tempotext }
#})
-\relative c'' {
+\relative {
\tempo \markup { "Low tempo" }
- c4 d e f g1
+ c''4 d e f g1
\tempoPadded #4.0 "High tempo"
g4 f e d c1
}