example, a music expression is assigned to a variable with the name
@code{traLaLa}.
@example
- traLaLa = \notes @{ c'4 d'4 @}
+ traLaLa = @{ c'4 d'4 @}
@end example
@noindent
@code{\paper} block also contains a @code{traLaLa} variable, which is
independent of the outer @code{\traLaLa}.
@example
- traLaLa = \notes @{ c'4 d'4 @}
+ traLaLa = @{ c'4 d'4 @}
\paper @{ traLaLa = 1.0 @}
@end example
@c
An anonymous Scheme module is attached to each scope. An assignment of
the form
@example
- traLaLa = \notes @{ c'4 d'4 @}
+ traLaLa = @{ c'4 d'4 @}
@end example
@noindent
is internally converted to a Scheme definition
@example
- (define traLaLa @var{Scheme value of ``@code{\notes ... }''})
+ (define traLaLa @var{Scheme value of ``@code{... }''})
@end example
This means that input variables and Scheme variables may be freely
imported in a @code{\score} by means of a second variable
@code{twice}:
@example
- traLaLa = \notes @{ c'4 d'4 @}
+ traLaLa = @{ c'4 d'4 @}
#(define newLa (map ly:music-deep-copy
(list traLaLa traLaLa)))
#(define twice
(make-sequential-music newLa))
- \score @{ \twice @}
+ @{ \twice @}
@end example
In the above example, music expressions can be `exported' from the
written as
@example
@dots{}
- \score @{ #(ly:export (make-sequential-music newLa)) @}
+ @{ #(ly:export (make-sequential-music newLa)) @}
@end example
@refbugs
(ly:music-set-property! m 'elements (reverse
(ly:music-property m 'elements)))
m)
- \score { \notes \applymusic #rev-music-1 { c4 d4 } }
+ \applymusic #rev-music-1 { c4 d4 }
@end lilypond
The use of such a function is very limited. The effect of this
The following two expressions give equivalent music expressions:
@example
mynotes = @{ \override Stem #'thickness = #4
- \notes @{ c'8 d' @} @}
+ @{ c'8 d' @} @}
#(define mynotes #@{ \override Stem #'thickness = #4
- \notes @{ c'8 d' @} #@})
+ @{ c'8 d' @} #@})
@end example
The content of @code{#@{ ... #@}} is enclosed in an implicit @code{@{
#(use-modules (ice-9 optargs))
#(define* (textpad padding #:optional once?)
(ly:export ; this is necessary for using the expression
- ; directly inside a \notes block
+ ; directly inside a block
(if once?
#{ \once \override TextScript #'padding = #$padding #}
#{ \override TextScript #'padding = #$padding #})))
- \score {
- \notes {
+ {
c'^"1"
#(textpad 3.0 #t) % only once
c'^"2"
c'^"5"
}
- }
@end lilypond
Here, the variable @code{padding} is a number; music expression
$music
\revert TextScript #'padding #}))
- \score {
- \notes {
+ {
c'^"1"
\applymusic #(with-padding 3)
{ c'^"2" c'^"3"}
c'^"4"
}
- }
@end lilypond
The function created by @code{(with-padding 3)} adds @code{\override} and
this new expression. Thus, this example is equivalent to:
@example
- \score @{
- \notes @{
+ @{
c'^"1"
@{ \override TextScript #'padding = #3
@{ c'^"2" c'^"3"@}
@}
c'^"4"
@}
- @}
@end example
This function may also be defined as a music function:
$music
\revert TextScript #'padding #})
- \score {
- \notes {
+ {
c'^"1"
\withPadding #3
{ c'^"2" c'^"3"}
c'^"4"
}
- }
@end lilypond
The final result is as follows:
@verbatim
-\score {
- \notes { \fatText
+ { \fatText
c''^\markup \character #"Cleopatra"
e'^\markup \character #"Giulio Cesare"
}
-}
@end verbatim
@lilypond[raggedright]
(interpret-markup paper props
(markup "" #:translate (cons -4 0) #:smallcaps name)))
-\score {
- \notes { \fatText
+ { \fatText
c''^\markup \character #"Cleopatra"
e'^\markup \character #"Giulio Cesare"
}
-}
@end lilypond
We have used the @code{caps} font shape, but suppose that our font