+2004-05-07 Han-Wen Nienhuys <hanwen@xs4all.nl>
+
+ * scripts/convert-ly.py (conv): \apply -> \applymusic
+
2004-05-06 Kristof Bastiaensen <kristof.bastiaensen@vleeuwen.org>
* elisp/lilypond-mode.el: changed the order of some commands
@example
\simultaneous @{
@var{the music}
- \apply #(remove-tag 'score) @var{the music}
- \apply #(remove-tag 'part) @var{the music}
+ \applymusic #(remove-tag 'score) @var{the music}
+ \applymusic #(remove-tag 'part) @var{the music}
@}
@end example
would yield
chords, e.g.
@c
@lilypond[quote,relative=2,verbatim]
-\apply #notes-to-clusters { <c e > <b f'> }
+\applymusic #notes-to-clusters { <c e > <b f'> }
@end lilypond
The following example (from
Such syntax can also be defined as user code. To do this, it is
necessary to create a @em{music function}. This is a specially marked
-Scheme function. For example, the music function @code{\apply} applies
+Scheme function. For example, the music function @code{\applymusic} applies
a user-defined function to a music expression. Its syntax is
@example
-\apply #@var{func} @var{music}
+\applymusic #@var{func} @var{music}
@end example
A music function is created with @code{ly:make-music-function},
(ly:make-music-function
@end example
-@code{\apply} takes a Scheme function and a Music expression as
+@code{\applymusic} takes a Scheme function and a Music expression as
argument. This is encoded in its first argument,
@example
@end example
The above Scheme code only defines the functionality. The tag
-@code{\apply} is selected by defining
+@code{\applymusic} is selected by defining
@example
apply = #(ly:make-music-function
(func music)))
@end example
-Examples of the use of @code{\apply} are in the next section.
+Examples of the use of @code{\applymusic} are in the next section.
@node Manipulating music expressions
@appendixsubsec Manipulating music expressions
Music objects and their properties can be accessed and manipulated
-directly, through the @code{\apply} mechanism.
-The syntax for @code{\apply} is
+directly, through the @code{\applymusic} mechanism.
+The syntax for @code{\applymusic} is
@example
-\apply #@var{func} @var{music}
+\applymusic #@var{func} @var{music}
@end example
@noindent
(ly:music-set-property! m 'elements (reverse
(ly:music-property m 'elements)))
m)
- \score { \notes \apply #rev-music-1 { c4 d4 } }
+ \score { \notes \applymusic #rev-music-1 { c4 d4 } }
@end lilypond
The use of such a function is very limited. The effect of this
multiple children. The following function application has no effect:
@example
- \apply #rev-music-1 \grace @{ c4 d4 @}
+ \applymusic #rev-music-1 \grace @{ c4 d4 @}
@end example
@noindent
In this case, @code{\grace} is stored as @internalsref{GraceMusic}, which has no
@code{elements}, only a single @code{element}. Every generally
-applicable function for @code{\apply} must -- like music expressions
+applicable function for @code{\applymusic} must -- like music expressions
themselves -- be recursive.
The following example is such a recursive function: It first extracts
\context Voice = "2" @{ \voiceTwo b @} >>
@end example
-Other applications of @code{\apply} are writing out repeats
+Other applications of @code{\applymusic} are writing out repeats
automatically (@inputfileref{input/test,unfold-all-repeats.ly}),
saving keystrokes (@inputfileref{input/test,music-box.ly}) and
exporting
-\version "2.2.0"
+\version "2.3.1"
\header {
-\version "2.2.0"
+\version "2.3.1"
\header {
texidoc = "The @code{\applyoutput} expression is the most flexible way to
texidoc = "With balloon texts, objects in the output can be marked,
with lines and explanatory text added."
}
-\version "2.2.0"
+\version "2.3.1"
\score {
\notes {
}
-\version "2.2.0"
+\version "2.3.1"
\score {
\notes \new PianoStaff <<
s1 *2
}
\context Staff = down <<
- \apply #notes-to-clusters \relative c { <c e>4 <f a> <b e> \change Staff = up <e a>
+ \applymusic #notes-to-clusters \relative c { <c e>4 <f a> <b e> \change Staff = up <e a>
<a d> <d g> }
{ \clef bass s1 * 2 }
-\version "2.2.0"
+\version "2.3.1"
\header {
texidoc = "Clusters are a device to denote that a complete range of
notes is to be played."
\score {
\notes <<
\new Staff \fragment
- \new Staff \apply #notes-to-clusters \fragment
+ \new Staff \applymusic #notes-to-clusters \fragment
>>
\paper { raggedright = ##t }
}
-\version "2.2.0"
+\version "2.3.1"
\header{
texidoc="
}
-\version "2.2.0"
+\version "2.3.1"
#(define (notes-to-skip m)
"Convert all stuff with duration (notes, lyrics, bass figures, etc.) to skips.
\notes \relative c'' \context Voice {
\foobar
- << \apply #(lambda (x) (music-map notes-to-skip x))
+ << \applymusic #(lambda (x) (music-map notes-to-skip x))
\foobar
{ d2 d2 } >>
}}
-\version "2.2.0"
+\version "2.3.1"
\header { texidoc = "Volta repeats may be unfolded through the Scheme
function @code{unfold-repeats}."
\notes \context Voice {
\nots
\bar "||"
- \apply #unfold-repeats \nots
+ \applymusic #unfold-repeats \nots
}
\paper {raggedright = ##t}
}
-\version "2.2.0"
+\version "2.3.1"
\header {
texidoc = "Unfolding tremolo repeats. All fragments fill one
\score{
\notes{
\time 2/4
- \apply #unfold-repeats
+ \applymusic #unfold-repeats
{ \repeat tremolo 4 { c'16 e' } |
\repeat tremolo 8 c'16 } |
\time 3/4
- \apply #unfold-repeats
+ \applymusic #unfold-repeats
{ \repeat tremolo 6 { c'16 e' } |
\repeat tremolo 12 c'16 } | \bar "|."
-\version "2.2.0"
+\version "2.3.1"
\header {
texidoc = "The @code{\\tag} command marks music expressions with a
}
\new Staff {
\set Staff.instrument = #"part"
- \apply #(remove-tag 'score) \common
+ \applymusic #(remove-tag 'score) \common
}
\new Staff {
\set Staff.instrument = #"score"
- \apply #(remove-tag 'part) \common
+ \applymusic #(remove-tag 'part) \common
}
}
}
-\version "2.2.0"
+\version "2.3.1"
\header {
texidoc="By a manual hack for nested tuplets, an outer tuplet can be moved up."
}
-\version "2.2.0"
+\version "2.3.1"
\header {
title = "Screech and boink"
subtitle = "Random complex notation"
\override Beam #'thickness = #0.3
\override Stem #'thickness = #4.0
g'16[ b16 fis16 g16]
- << \apply #notes-to-clusters {
+ << \applymusic #notes-to-clusters {
as16 <as b>
<g b>
<g cis>
-\version "2.2.0"
+\version "2.3.1"
\header {
\score {
\notes\relative c'' {
- a b \apply #(lambda (x) (music-map add-staccato x)) { c c }
+ a b \applymusic #(lambda (x) (music-map add-staccato x)) { c c }
}
\paper{ raggedright = ##t }
}
-\version "2.2.0"
+\version "2.3.1"
\header {
texidoc= "@cindex make-music Fingering
m)
\score {
- \apply #(lambda (x) (add-text-script x "6") (display-music x) x ) \notes { c'4-3 }
+ \applymusic #(lambda (x) (add-text-script x "6") (display-music x) x ) \notes { c'4-3 }
\paper{ raggedright = ##t }
}
"
}
-\version "2.2.0"
+\version "2.3.1"
#(define (kill-ambitus grob grob-context apply-context)
(if (memq 'ambitus-interface (ly:grob-property grob 'interfaces))
-\version "2.2.0"
+\version "2.3.1"
% TODO: split ancient-font into seperate files; possibly in
% different locations.
\header {
-\version "2.2.0"
+\version "2.3.1"
\header {
texidoc = "@cindex Bar Number Every Fifth Reset
-\version "2.2.0"
+\version "2.3.1"
% possible rename to scheme- or something like that. -gp
\header { texidoc= "@cindex Scheme Manual Accidentals
-\version "2.2.0"
+\version "2.3.1"
% possible rename to scheme- or something like that. -gp
\header { texidoc = "@cindex Scheme Move Text
Objects, like text, can be moved around by using some Scheme code.
-\version "2.2.0"
+\version "2.3.1"
\include "deutsch.ly"
% possible rename to scheme- something. -gp
% TODO: ask if it needs to have so many empty bars in the middle. -gp
-\version "2.2.0"
+\version "2.3.1"
pat = \notes \transpose c c' \repeat unfold 2 {
<< { \context Staff=up {r8 e16 f g e f g } }
\notes \transpose c c' \context PianoStaff <<
\context Staff=up { \clef "G" }
\context Staff=down { \clef "F" }
- { \apply #transform {\pat {c e g c' e' }
+ { \applymusic #transform {\pat {c e g c' e' }
\pat {c d a d' f' }
\pat {h, d g d' f' }
\pat {c e g c' e' }
-\version "2.2.0"
+\version "2.3.1"
\header{ texidoc="
\new Staff {
\time 3/4
\set Staff.timeSignatureFraction = #'(9 . 8)
- \apply #(scale-music-function '(2 . 3))
+ \applymusic #(scale-music-function '(2 . 3))
\repeat unfold 6 { c8[ c c] }
}
\new Staff {
\time 3/4
\set Staff.timeSignatureFraction = #'(10 . 8)
- \apply #(scale-music-function '(3 . 5))
+ \applymusic #(scale-music-function '(3 . 5))
{ \repeat unfold 2 { c8[ c c] }
\repeat unfold 2 { c8[ c] }
| c4. c4. \times 2/3 { c8 c c } c4 }
-\version "2.2.0"
+\version "2.3.1"
% possible rename to scheme-something.
\header { texidoc="@cindex Scheme Reverse Music
Symmetric, or palindromical music can be produced, first, by printing
\score {
\context Voice {
\music
- \apply #reverse-music \music
+ \applymusic #reverse-music \music
}
\paper { raggedright = ##t}
}
-\version "2.2.0"
+\version "2.3.1"
\header {
texidoc="@cindex Smart Transpose
\score {
\notes \context Staff {
\transpose c ais \music
- \apply #naturalise \transpose c ais \music
+ \applymusic #naturalise \transpose c ais \music
\transpose c deses \music
- \apply #naturalise \transpose c deses \music
+ \applymusic #naturalise \transpose c deses \music
}
\paper { raggedright = ##t}
}
-\version "2.2.0"
+\version "2.3.1"
% regression. -gp
\header {
\score { \notes {
\mel \break
- \apply #unfold-repeats \mel
+ \applymusic #unfold-repeats \mel
}
}
-\version "2.3.0"
+\version "2.3.1"
\header {
texidoc = "Wilhelmus van Nassouwe"
{
SCM value = SCM_CELL_OBJECT_1 (b);
- scm_puts ("#<packaged object ", port);
+ scm_puts ("#<Music function ", port);
scm_write (value, port);
scm_puts (">", port);
scm_set_smob_mark (music_function_tag, scm_markcdr);
scm_set_smob_print (music_function_tag, print_music_function);
}
+
ADD_SCM_INIT_FUNC (music_function_tag, init_music_function);
SCM func = ly_car ($1);
Input *loc = unsmob_input (ly_cadr ($1));
SCM args = ly_cddr ($1);
- SCM sig = scm_object_property (func, ly_symbol2scm ("music-head-signature"));
+ SCM sig = scm_object_property (func, ly_symbol2scm ("music-function-signature"));
int k = 0;
bool ok = true;
for (SCM s = sig, t = args;
$$ = unsmob_music (m);
scm_gc_protect_object (m);
}
- else
+ else
{
- loc->error (_ ("Music head function should return Music object."));
+ if (ok)
+ loc->error (_ ("Music head function should return Music object."));
$$ = MY_MAKE_MUSIC ("Music");
}
$$->set_spot (*loc);
-\version "2.2.0"
+\version "2.3.1"
startGraceMusic = \notes {
(define all-scheme-functions
(hash-fold
(lambda (key val prior)
- (cons (cons key val) prior)
- )
+ (cons (cons key val) prior))
'() (ly:get-all-function-documentation)))
(define (all-scheme-functions-doc)
(let*
- (
-
- (fdocs (map (lambda (x)
+ ((fdocs (map (lambda (x)
(document-scheme-function (car x) (cadr x) (cddr x))
)
all-scheme-functions)
)
(sfdocs (sort fdocs string<?))
+
)
-
(make <texi-node>
#:name "Scheme functions"
#:desc "Primitive functions exported by LilyPond"
#:text
- (apply string-append sfdocs)
- )
+ (apply string-append sfdocs))
))
conversions.append (((2,2, 0), conv,
'''clean up version. '''))
+def conv (str):
+ return re.sub (r'\\apply\b', r'\\applymusic', str)
+
+conversions.append (((2, 3, 1), conv,
+ '''\\apply -> \\applymusic'''))
+
################################
# END OF CONVERSIONS
################################