;;;; along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
(define-public (construct-chord-elements root duration modifications)
- " Build a chord on root using modifiers in MODIFICATIONS. NoteEvents
+ " Build a chord on root using modifiers in MODIFICATIONS. NoteEvents
have duration DURATION.
Notes: natural 11 is left from chord if not explicitly specified.
(start-additions #t))
(define (interpret-inversion chord mods)
- "Read /FOO part. Side effect: INVERSION is set."
+ "Read /FOO part. Side effect: INVERSION is set."
(if (and (> (length mods) 1) (eq? (car mods) 'chord-slash))
(begin
(set! inversion (cadr mods))
(interpret-bass chord mods))
(define (interpret-bass chord mods)
- "Read /+FOO part. Side effect: BASS is set."
+ "Read /+FOO part. Side effect: BASS is set."
(if (and (> (length mods) 1) (eq? (car mods) 'chord-bass))
(begin
(set! bass (cadr mods))
(interpret-inversion chord mods)))
(define (interpret-additions chord mods)
- "Interpret additions. TODO: should restrict modifier use?"
+ "Interpret additions. TODO: should restrict modifier use?"
(cond ((null? mods) chord)
((ly:pitch? (car mods))
(if (= (pitch-step (car mods)) 11)
'(1 3 5 7 9 11 13)))
(define (stack-thirds upper-step base)
- "Stack thirds listed in BASE until we reach UPPER-STEP. Add
+ "Stack thirds listed in BASE until we reach UPPER-STEP. Add
UPPER-STEP separately."
(cond ((null? base) '())
((> (ly:pitch-steps upper-step) (ly:pitch-steps (car base)))
;; todo: naming is confusing: steps (0 based) vs. steps (1 based).
(define (pitch-step p)
- "Musicological notation for an interval. Eg. C to D is 2."
+ "Musicological notation for an interval. Eg. C to D is 2."
(+ 1 (ly:pitch-steps p)))
(define (get-step x ps)
bass-pitch
lowercase-root?)
- "Format for the given (lists of) pitches. This is actually more
+ "Format for the given (lists of) pitches. This is actually more
work than classifying the pitches."
(define (filter-main-name p)
;;
(define-public (system-clipped-x-extent system-grob clip-region)
"Return the X-extent of the SYSTEM-GROB when clipped with
-CLIP-REGION. Return #f if not appropriate."
+CLIP-REGION. Return #f if not appropriate."
(let*
((region-start (car clip-region))
@item symbol
The symbol is the name of the context in which the following rules are to be
-applied. For example, if @var{context} is @rinternals{Score} then all
+applied. For example, if @var{context} is @rinternals{Score} then all
staves share accidentals, and if @var{context} is @rinternals{Staff} then
all voices in the same staff share accidentals, but staves do not.
@end table
-The procedure returns a pair of booleans. The first states whether an extra
-natural should be added. The second states whether an accidental should be
-printed. @code{(#t . #f)} does not make sense.
+The procedure returns a pair of booleans. The first states whether an extra
+natural should be added. The second states whether an accidental should be
+printed. @code{(#t . #f)} does not make sense.
@end table")
(autoBeamCheck ,procedure? "A procedure taking three
(ly:message (_ "Using `~a' note names...") str))
(set! pitchnames alist)
(ly:parser-set-note-names parser alist))
- (ly:warning (_ "Could not find language `~a'. Ignoring.") str))))
+ (ly:warning (_ "Could not find language `~a'. Ignoring.") str))))
(define-macro (define-display-method music-type vars . body)
"Define a display method for a music type and store it in the
`display-methods' property of the music type entry found in the
-`music-name-to-property-table' hash table. Print methods previously
+`music-name-to-property-table' hash table. Print methods previously
defined for that music type are lost.
Syntax: (define-display-method MusicType (expression parser)
...body...))"
method))
(define-macro (define-extra-display-method music-type vars . body)
- "Add a display method for a music type. A primary display method
+ "Add a display method for a music type. A primary display method
is supposed to have been previously defined with `define-display-method'.
-This new method should return a string or #f. If #f is returned, the next
+This new method should return a string or #f. If #f is returned, the next
display method will be called."
`(let* ((type-props (hashq-ref music-name-to-property-table
',music-type '()))
elements-list))))
(define-macro (with-music-match music-expr+pattern . body)
- "If `music-expr' matches `pattern', call `body'. `pattern' should look like:
+ "If `music-expr' matches `pattern', call `body'. `pattern' should look like:
'(music <MusicType>
property value
property ?var1
keyword), then all music expression found in its properties (such as 'element
or 'elements).
When ?var is found instead of a property value, ?var is bound that property value,
-as read inside `music-expr'. ?var may also be used to refere to a whole music
-expression inside an elements list for instance. These bindings are accessible
+as read inside `music-expr'. ?var may also be used to refere to a whole music
+expression inside an elements list for instance. These bindings are accessible
inside body."
(let ((music-expr (first music-expr+pattern))
(pattern (second music-expr+pattern))
instrument, invoke @code{(print-keys-verbose 'instrument)}.
Lastly, substituting an empty list for the pressed-key alist will result in
-a diagram with all of the keys drawn but none filled. ie...
+a diagram with all of the keys drawn but none filled, for example:
@example
\\markup \\woodwind-diagram #'oboe #'()
name)
(define (ref-ify x)
- "Return @ref{X}. If mapping ref-ify to a list that needs to be sorted,
+ "Return @ref{X}. If mapping ref-ify to a list that needs to be sorted,
sort the list first."
(string-append "@ref{" x "}"))
ends at (0, vertical-center-of-flag-end) - (flag-x-width/2, flag-x-width + flag-thickness).
Here length is the whole length, while flag-x-width is just the
x-extent and thus depends on the angle! Other combinations don't look as
- good... For down-stems the y-coordinates are simply mirrored."
+ good... For down-stems the y-coordinates are simply mirrored."
(let* ((start (offset-add offset (cons 0 (* (/ length 2) dir))))
(end (offset-add (cons 0 (cdr offset))
(cons (- (/ (car offset) 2)) (* (- (+ thickness (car offset))) dir))))
((straight-flag 0.55 1 -18 1.1 22 1.2) stem-grob))
(define-public (old-straight-flag stem-grob)
- "Old straight flag style (for composers like Bach). The angles of the flags
+ "Old straight flag style (for composers like Bach). The angles of the flags
are both 45 degrees."
((straight-flag 0.55 1 -45 1.2 45 1.4) stem-grob))
(define-public (default-flag stem-grob)
- "Create a flag stencil for the stem. Its style will be derived from the
- @code{'flag-style} Stem property. By default, @code{lilypond} uses a
+ "Create a flag stencil for the stem. Its style will be derived from the
+ @code{'flag-style} Stem property. By default, @code{lilypond} uses a
C++ Function (which is slightly faster) to do exactly the same as this
- function. However, if one wants to modify the default flags, this function
+ function. However, if one wants to modify the default flags, this function
can be used to obtain the default flag stencil, which can then be modified
- at will. The correct way to do this is:
+ at will. The correct way to do this is:
@example
\\override Stem #'flag = #default-flag
\\override Stem #'flag-style = #'mensural
Arguments:
NODE the font tree to modify.
- NAME is the basename for the music font. NAME-DESIGNSIZE.otf should be the music font,
+ NAME is the basename for the music font. NAME-DESIGNSIZE.otf should be the music font,
NAME-brace.otf should have piano braces.
DESIGN-SIZE-ALIST is a list of (ROUNDED . DESIGN-SIZE). ROUNDED is
a suffix for font filenames, while DESIGN-SIZE should be the actual
(define-public (dump-stencil-as-EPS-with-bbox paper dump-me filename
load-fonts
bbox)
- "Create an EPS file from stencil DUMP-ME to FILENAME. BBOX has
+ "Create an EPS file from stencil DUMP-ME to FILENAME. BBOX has
format (left-x, lower-y, right x, up-y). If LOAD-FONTS set, include
fonts inline."
(define (to-rounded-bp-box box)
(define (merge-details key alist-list . default)
"Return @code{alist-list} entries for @code{key}, in one combined alist.
-There can be two @code{alist-list} entries for a given key. The first
+There can be two @code{alist-list} entries for a given key. The first
comes from the override-markup function, the second comes
from property settings during a regular override.
This is necessary because some details can be set in one
"Draw the string lines for a fret diagram with
@var{string-count} strings and frets as indicated in @var{fret-range}.
Line thickness is given by @var{th}, fret & string spacing by
-@var{size}. Orientation is determined by @var{orientation}. "
+@var{size}. Orientation is determined by @var{orientation}."
(define (helper x)
(if (null? (cdr x))
"Draw the fret lines for a fret diagram with
@var{string-count} strings and frets as indicated in @var{fret-range}.
Line thickness is given by @var{th}, fret & string spacing by
-@var{size}. Orientation is given by @var{orientation}."
+@var{size}. Orientation is given by @var{orientation}."
(define (helper x)
(if (null? (cdr x))
(fret-stencil (car x))
@end table
The function also checks if the string has the typical form of three
-pedals, then the divider and then the remaining four pedals. If not it
-prints out a warning. However, in any case, it will also print each symbol
-in the order as given. This means you can place the divider (even multiple
+pedals, then the divider and then the remaining four pedals. If not it
+prints out a warning. However, in any case, it will also print each symbol
+in the order as given. This means you can place the divider (even multiple
dividers) anywhere you want, but you'll have to live with the warnings.
The appearance of the diagram can be tweaked inter alia using the size property
of the TextScript grob (@code{\\override Voice.TextScript #'size = #0.3}) for
the overall, the thickness property
(@code{\\override Voice.TextScript #'thickness = #3}) for the line thickness of
-the horizontal line and the divider. The remaining configuration (box sizes,
+the horizontal line and the divider. The remaining configuration (box sizes,
offsets and spaces) is done by the harp-pedal-details list of properties
(@code{\\override Voice.TextScript #'harp-pedal-details #'box-width = #1}).
It contains the following settings: @code{box-offset} (vertical shift of the
(if (null? (cdr info))
(ly:warning "Harp pedal diagram does not contain a divider (usually after third pedal).")
(if (not (equal? (cdr info) '(3)))
- (ly:warning "Harp pedal diagram contains dividers at positions ~a. Normally, there is only one divider after the third pedal." (cdr info))))))
+ (ly:warning "Harp pedal diagram contains dividers at positions ~a. Normally, there is only one divider after the third pedal." (cdr info))))))
(map-alist-vals func (cdr list)))))
(define (map-alist-keys func list)
- "map FUNC over the keys of an alist LIST, leaving the vals. "
+ "map FUNC over the keys of an alist LIST, leaving the vals."
(if (null? list)
'()
(cons (cons (func (caar list)) (cdar list))
(helper lst 0))
(define-public (count-list lst)
- "Given lst (E1 E2 .. ) return ((E1 . 1) (E2 . 2) ... ) "
+ "Given lst (E1 E2 .. ), return ((E1 . 1) (E2 . 2) ... )."
(define (helper l acc count)
(if (pair? l)
(lset-difference eq? a b))
(define-public (uniq-list lst)
- "Uniq LST, assuming that it is sorted. Uses equal? for comparisons."
+ "Uniq LST, assuming that it is sorted. Uses equal? for comparisons."
(reverse!
(fold (lambda (x acc)
(define (split-at-predicate pred lst)
"Split LST into two lists at the first element that returns #f for
- (PRED previous_element element). Return the two parts as a pair.
+ (PRED previous_element element). Return the two parts as a pair.
Example: (split-at-predicate < '(1 2 3 2 1)) ==> ((1 2 3) . (2 1))"
(if (null? lst)
(list lst)
(define-public (split-list-by-separator lst pred)
"Split LST at each element that satisfies PRED, and return the parts
- (with the separators removed) as a list of lists. Example:
+ (with the separators removed) as a list of lists. Example:
(split-list-by-separator '(a 0 b c 1 d) number?) ==> ((a) (b c) (d))"
(let loop ((result '()) (lst lst))
(if (and lst (not (null? lst)))
(define-public (eval-carefully symbol module . default)
"Check if all symbols in expr SYMBOL are reachable
- in module MODULE. In that case evaluate, otherwise
- print a warning and set an optional DEFAULT."
+in module MODULE. In that case evaluate, otherwise
+print a warning and set an optional DEFAULT."
(let* ((unavailable? (lambda (sym)
(not (module-defined? module sym))))
(sym-unavailable (if (pair? symbol)
(define (ly:alist<? a b)
"Return #t if the first key of alist A is less than the first key of
- alist B, using case-sensitive LilyPond sort order. Keys are assumed to
+ alist B, using case-sensitive LilyPond sort order. Keys are assumed to
be symbols."
(ly:string<? (symbol->string (car a))
(symbol->string (car b))))
(define (ly:alist-ci<? a b)
"Return #t if the first key of alist A is less than the first key of
- alist B, using case-insensitive LilyPond sort order. Keys are assumed
+ alist B, using case-insensitive LilyPond sort order. Keys are assumed
to be symbols."
(ly:string-ci<? (symbol->string (car a))
(symbol->string (car b))))
,(symbol->string make-markup-name) sig args)))))))
(define-public (make-markup markup-function make-name signature args)
- " Construct a markup object from MARKUP-FUNCTION and ARGS. Typecheck
+ " Construct a markup object from MARKUP-FUNCTION and ARGS. Typecheck
against SIGNATURE, reporting MAKE-NAME as the user-invoked function.
"
(let* ((arglen (length args))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define-public (shift-one-duration-log music shift dot)
- " add SHIFT to duration-log of 'duration in music and optionally
- a dot to any note encountered. This scales the music up by a factor
- 2^shift * (2 - (1/2)^dot)"
+ "Add SHIFT to duration-log of 'duration in music and optionally
+a dot to any note encountered. This scales the music up by a factor
+2^shift * (2 - (1/2)^dot)."
(let ((d (ly:music-property music 'duration)))
(if (ly:duration? d)
(let* ((cp (ly:duration-factor d))
;; property setting music objs.
(define-public (make-grob-property-set grob gprop val)
- "Make a Music expression that sets GPROP to VAL in GROB. Does a pop first,
-i.e. this is not an override"
+ "Make a Music expression that sets GPROP to VAL in GROB. Does a pop first,
+i.e., this is not an override."
(make-music 'OverrideProperty
'symbol grob
'grob-property gprop
(define-safe-public (context-spec-music m context #:optional id)
- "Add \\context CONTEXT = ID to M. "
+ "Add \\context CONTEXT = ID to M."
(let ((cm (make-music 'ContextSpeccedMusic
'element m
'context-type context)))
cm))
(define-public (descend-to-context m context)
- "Like context-spec-music, but only descending. "
+ "Like context-spec-music, but only descending."
(let ((cm (context-spec-music m context)))
(ly:music-set-property! cm 'descend-only #t)
cm))
(define (voicify-list lst number)
"Make a list of Musics.
- voicify-list :: [ [Music ] ] -> number -> [Music]
- LST is a list music-lists.
+voicify-list :: [ [Music ] ] -> number -> [Music]
+LST is a list music-lists.
- NUMBER is 0-base, i.e. Voice=1 (upstems) has number 0.
+NUMBER is 0-base, i.e., Voice=1 (upstems) has number 0.
"
(if (null? lst)
'()
(define-public (skip->rest mus)
"Replace MUS by RestEvent of the same duration if it is a
-SkipEvent. Useful for extracting parts from crowded scores"
+SkipEvent. Useful for extracting parts from crowded scores."
(if (memq (ly:music-property mus 'name) '(SkipEvent SkipMusic))
(make-music 'RestEvent 'duration (ly:music-property mus 'duration))
nv))
(define (vector-map f v)
- "Map F over V. This function returns nothing."
+ "Map F over V. This function returns nothing."
(do ((n (vector-length v))
(i 0 (+ i 1)))
((>= i n))
(f (vector-ref v i))))
(define (vector-reverse-map f v)
- "Map F over V, N to 0 order. This function returns nothing."
+ "Map F over V, N to 0 order. This function returns nothing."
(do ((i (- (vector-length v) 1) (- i 1)))
((< i 0))
(f (vector-ref v i))))
(define-public (add-grace-property context-name grob sym val)
- "Set SYM=VAL for GROB in CONTEXT-NAME. "
+ "Set SYM=VAL for GROB in CONTEXT-NAME."
(define (set-prop context)
(let* ((where (ly:context-property-where-defined context 'graceSettings))
(current (ly:context-property where 'graceSettings))
(ly:export (context-spec-music (make-apply-context set-prop) 'Voice)))
(define-public (remove-grace-property context-name grob sym)
- "Remove all SYM for GROB in CONTEXT-NAME. "
+ "Remove all SYM for GROB in CONTEXT-NAME."
(define (sym-grob-context? property sym grob context-name)
(and (eq? (car property) context-name)
(eq? (cadr property) grob)
(define (check-pitch-against-signature context pitch barnum laziness octaveness)
"Checks the need for an accidental and a @q{restore} accidental against
-@code{localKeySignature}. The @var{laziness} is the number of measures
+@code{localKeySignature}. The @var{laziness} is the number of measures
for which reminder accidentals are used (i.e., if @var{laziness} is zero,
only cancel accidentals in the same measure; if @var{laziness} is three,
we cancel accidentals up to three measures after they first appear.
(define-public ((make-accidental-rule octaveness laziness) context pitch barnum measurepos)
"Creates an accidental rule that makes its decision based on the octave of the note
- and a laziness value.
- octaveness is either 'same-octave or 'any-octave and defines whether the rule should
- respond to accidental changes in other octaves than the current. 'same-octave is the
- normal way to typeset accidentals - an accidental is made if the alteration is different
- from the last active pitch in the same octave. 'any-octave looks at the last active pitch
- in any octave.
- laziness states over how many bars an accidental should be remembered.
- 0 is default - accidental lasts over 0 bar lines, that is, to the end of current measure.
- A positive integer means that the accidental lasts over that many bar lines.
- -1 is 'forget immediately', that is, only look at key signature.
- #t is forever."
+and a laziness value.
+octaveness is either 'same-octave or 'any-octave and defines whether the rule should
+respond to accidental changes in other octaves than the current. 'same-octave is the
+normal way to typeset accidentals - an accidental is made if the alteration is different
+from the last active pitch in the same octave. 'any-octave looks at the last active pitch
+in any octave.
+laziness states over how many bars an accidental should be remembered.
+0 is default - accidental lasts over 0 bar lines, that is, to the end of current measure.
+A positive integer means that the accidental lasts over that many bar lines.
+-1 is 'forget immediately', that is, only look at key signature.
+#t is forever."
(check-pitch-against-signature context pitch barnum laziness octaveness))
(define (key-entry-notename entry)
- "Return the pitch of an entry in localKeySignature. The entry is either of the form
+ "Return the pitch of an entry in localKeySignature. The entry is either of the form
'(notename . alter) or '((octave . notename) . (alter barnum . measurepos))."
(if (number? (car entry))
(car entry)
context))
(define-public (set-accidental-style style . rest)
- "Set accidental style to STYLE. Optionally takes a context argument,
-e.g. 'Staff or 'Voice. The context defaults to Staff, except for piano styles, which
-use GrandStaff as a context. "
+ "Set accidental style to STYLE. Optionally takes a context argument,
+e.g. 'Staff or 'Voice. The context defaults to Staff, except for piano styles, which
+use GrandStaff as a context."
(let ((context (if (pair? rest)
(car rest) 'Staff))
(pcontext (if (pair? rest)
(define (str4 num)
(if (or (nan? num) (inf? num))
(begin
- (ly:warning (_ "Found infinity or nan in output. Substituting 0.0"))
+ (ly:warning (_ "Found infinity or nan in output. Substituting 0.0"))
(if (ly:get-option 'strict-infinity-checking)
(exit 1))
"0.0")
(define-public (read-lily-expression chr port)
"Read a #{ lily music expression #} from port and return
-the scheme music expression. The $ character may be used to introduce
-scheme forms, typically symbols. $$ may be used to simply write a `$'
+the scheme music expression. The $ character may be used to introduce
+scheme forms, typically symbols. $$ may be used to simply write a `$'
character."
(let ((bindings '()))
(previous-voice-state vs)))
(define (try-solo type start-idx current-idx)
- "Find a maximum stretch that can be marked as solo. Only set
+ "Find a maximum stretch that can be marked as solo. Only set
the mark when there are no spanners active.
return next idx to analyse.
start-idx))
(define (analyse-moment result-idx)
- "Analyse 'apart starting at RESULT-IDX. Return next index. "
+ "Analyse 'apart starting at RESULT-IDX. Return next index."
(let* ((now-state (vector-ref result result-idx))
(vs1 (current-voice-state now-state 1))
(vs2 (current-voice-state now-state 2))
(define (override-property-setting context property setting value)
"Like the C++ code that executes \\override, but without type
-checking. "
+checking."
(begin
(revert-property-setting context property setting)
(ly:context-set-property!
(define (revert-property-setting context property setting)
"Like the C++ code that executes \revert, but without type
-checking. "
+checking."
(define (entry-count alist entry-key)
"Count the number of entries in alist with a key of
(define-public (override-time-signature-setting time-signature setting)
"Override the time signature settings for the context in @var{rest},
-with the new setting alist @var{setting}. "
+with the new setting alist @var{setting}."
(context-spec-music
(make-apply-context
(lambda (c) (override-property-setting
layout scopes page-number is-last-bookpart is-bookpart-last-page)
"Read variables WHAT-ODD, WHAT-EVEN from LAYOUT, and interpret them
-as markup. The PROPS argument will include variables set in SCOPES and
+as markup. The PROPS argument will include variables set in SCOPES and
page:is-bookpart-last-page, page:is-last-bookpart, page:page-number-string
and page:page-number"
(get what-odd))))
(define-public ((marked-up-title what) layout scopes)
- "Read variables WHAT from SCOPES, and interpret it as markup. The
+ "Read variables WHAT from SCOPES, and interpret it as markup. The
PROPS argument will include variables set in SCOPES (prefixed with
`header:'
"