]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/automated-engraving/scoring-esthetics.itexi
Thinko: dist .ihtml source files in doc directories
[lilypond.git] / Documentation / automated-engraving / scoring-esthetics.itexi
1 @c -*- coding: utf-8; mode: texinfo; -*-
2 @ignore
3     Translation of GIT committish: FILL-IN-HEAD-COMMITTISH
4
5     When revising a translation, copy the HEAD committish of the
6     version that you are working on.  See TRANSLATION for details.
7 @end ignore
8
9
10 @node scoring-esthetics
11 @unnumberedsec Beautiful numbers 
12         
13 How do we actually make formatting decisions?  In other words, which
14 of the three configurations should we choose for the following slur?
15
16 @sourceimage{slur-esthetics,,,.png}
17
18 There are a few books on the art of music engraving
19 available. Unfortunately, they contain rules of simple thumbs and some
20 examples.  Such rules can be instructive, but they are a far cry from
21 an algorithm that we could readily implement in a computer.  Following
22 the instructions from literature leads to algorithms with lots of
23 handcoded exceptions. Doing all this case analysis is a lot of work,
24 and often not all cases are covered completely.
25
26 @divClass{float-center}
27 @sourceimage{ross-beam-scan,,,.png}
28 @divEnd
29
30 @divClass{float-center}
31 @emph{Formatting rules defined by example. Image from Ted Ross' The Art of
32 Music Engraving}
33 @divEnd
34
35 We have developed a much easier and robust method of determining the
36 best formatting solution: score based formatting. The principle is the
37 same as a beauty contest: for each possible configuration, we compute an
38 ugliness score. Then we choose the least ugly configuration.
39
40 @sourceimage{slur-esthetics-annotate-1,,,.png}
41
42 For example, in the above configuration, the slur nicely connects the
43 starting and ending note of the figure, a desirable trait. However, it
44 also grazes one note head closely, while staying away from the others.
45 Therefore, for this configuration, we deduct a `variance' score of
46 15.39.
47
48 @sourceimage{slur-esthetics-annotate-2,,,.png}
49
50 In this configuration, the slur keeps a uniform distance from the
51 heads, but we have to deduct some points because the slur doesn't
52 start and end on the note heads.  For the left edge, we deduct 1.71,
53 and for the right edge (which is further from the head) we deduct 9.37
54 points.
55
56 Furthermore, the slur goes up, while the melody goes down. This incurs
57 a penalty of 2.00 points
58
59 @sourceimage{slur-esthetics-annotate-3,,,.png}
60
61 Finally, in this configuration, only the ending the slur is far away
62 from the ending note head, at a score of 10.04 ugliness points.
63
64 Adding up all scores, we notice that the third option is the least
65 ugly, or most beautiful version.   Hence we select that one.
66
67 This technique is a general technique, and it is used in a lot of
68 situations, for example
69
70 @itemize
71 @item
72  determining beam slopes
73
74 @sourceimage{beam-scoring-example,,,.png}
75
76 @item
77  formatting tied chords
78
79 @sourceimage{ties-scoring-example,,,.png}
80 @item
81  formatting dotted chords
82
83
84 @item
85  line breaking
86
87 @item
88  page breaking  
89
90 @end itemize
91
92 This technique evaluates a lot of possibilities, which takes some time
93 to compute. However, that is a worthwhile expense, because the end
94 result is much better, and because it makes our lives easy.
95
96 @divClass{float-right}
97 Next: @ref{benchmarking,Man is the measure of things}: is a
98 flexible architecture enough?
99 @divEnd