Keywords

These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.

1 Introduction

The Oxford dictionary defines aesthetics as a set of principles concerned with the nature and appreciation of beauty, especially in art . Traditionally it is also a branch of philosophy concerned with the nature, expression, and perception of beauty and artistic taste [1]. The design of algorithms that generate “good” musical rhythms thus falls in the domain of computational aesthetics which is concerned with questions such as: How can the computer generate aesthetic objects without human intervention? [2]. A related question also asked is: How can the arts influence computer generated aesthetic objects? This question is sometimes attributed to another emergent field called aesthetic computing [3 ] . These two fields are, not surprisingly, inextricably intertwined. Not only do artistic principles provide artificial intelligence researchers with new ideas, but the results of computer programs influence artistic practices. Closely related to these two emerging computational fields is the area concerned with constructing mathematical measures of aesthetics, which goes back most notably to at least the work of Birkhoff [46] and should not be confused with the field that studies the aesthetics of mathematics [7]. The former attempts to develop mathematical measures of aesthetics that predict human aesthetic judgments, whereas the latter is concerned with studying the role of aesthetics in the mathematical research carried out by mathematicians. Not surprisingly these two fields are also inextricably intertwined. Indeed, the philosopher Oswald Spengler [8] wrote: “The mathematics of beauty and the beauty of mathematics are ... inseparable.”

Most research in these fields has been limited to the visual arts , such as painting [9], and less attention has been paid to music in general [10, 11] and musical rhythm in particular [1214]. Mathematical measures of aesthetics explore a variety of features such as symmetry [15], the Golden section [1618], and complexity [19] to determine how well they correlate with human judgments [20 ] .

It is useful to distinguish between algorithmic generation of music, and generation of music using electronic digital computers. The word ‘algorithmic’ specifies the use of well defined rules, without necessarily implying that these rules must be implemented on an electronic digital computer. Indeed the algorithmic approach to music composition may use any other method such as rolling dice with human hands to generate rhythms and melodies, as was popular in 18th century Europe [21], when more than twenty algorithmic processes were devised, inspired by the new developments in mathematics and probability theory that were receiving public attention at the time. In this sense algorithmic composition predates the advent of the electronic digital computer by centuries if not millennia. Following the introduction of the simple dice-rolling methods employed in 18th century Europe, much work has been done using more advanced approaches for incorporating randomness to compose music. Such methods usually involve the application of Markov processes [22]. Markov processes work well in general for applications where short-term dependencies are sufficient to capture relevant information, such as in text recognition [23, 24]. To exploit long term dependencies in musical rhythm, probabilistic methods that incorporate the distributions of distances between subsequences have been shown to be superior to more traditional Markov methods [25]. Other approaches that incorporate randomness to generate musical rhythms include genetic algorithms that use probabilistic rules to mutate rhythms to obtain new better rhythms [13, 26]. Some systems, such as The Continuator, interact with a musician during a performance, and either modify the music that the performer plays, or generate music that complements what is being played by the performer [27].

The methods described above generate rhythms using complex probabilistic algorithms that involve parameters that must be tuned in order to yield “good” rhythms, with sufficiently high probability. Furthermore, the “goodness” or quality of the rhythms produced by these methods is evaluated either by mathematical measures of aesthetics such as fitness functions in simulated annealing and genetic algorithms [28, 29], or by human beings who are usually the designers of the algorithms .

In contrast to the complex and probabilistic methods outlined above, this chapter provides a description of some simple and deterministic rules that are guaranteed (within specified limits of rhythm length) to generate “good” musical rhythms. Furthermore, in contrast to the above methods that measure “goodness” by either human evaluations, or with mathematical measures of “goodness,” the methods described in the following consider a rhythm to be “good” if it belongs to the repertoire of the musical tradition of some culture in the world, is used frequently as an ostinato or timeline, and has withstood the test of time. Typical examples of “good” rhythms that satisfy this definition are the timelines in Sub-Saharan music [12, 3033], the talas in Indian music [34], the compas in the Flamenco music of southern Spain [35], and the wazn in Arabic music [3638].

The most convenient and economical representation of a musical rhythm is in box notation as a sequence of binary symbols that represent sounds and silences, each of which has a duration of one unit of time. In text the simplest visualization uses the symbols “x” and “.” to denote the onset of a sound and a silent pulse (unit rest), respectively. Thus the sixteen-pulse, five-onset clave son rhythm would be represented by the sequence [x . . x . . x . . . x . x . . .]. Such a skeletal representation is eminently suited to objective mathematical and computational analyses, while at the same time, and perhaps surprisingly, encapsulates a rich enough structure to provide considerable musical insight into both the theory and practice of musical rhythm. Here several simple deterministic algorithms for generating musical rhythms are reviewed and compared in terms of their ability to capture “goodness” as defined above.

2 Maximally Even Rhythms and the Euclidean Algorithm

The most salient simple deterministic rule that generates “good” rhythms yields rhythms that have the property that their onsets are distributed in the rhythmic cycle as evenly as possible. In 2004 the author discovered that the ancient Greek algorithm for determining the greatest common divisor of two numbers, known as the Euclidean Algorithm [39 ] , generates scores of traditional musical rhythms from cultures all over the world. For this reason they are called Euclidean rhythms . This discovery was first published in the Bridges-2005 conference held in Banff (Canada) [40], and most recently re-published in Interalia Magazine [41]. Furthermore, it turns out that the Euclidean algorithm generates rhythms that have their onsets distributed as evenly as possible in the rhythmic cycle. Sets that have this property are termed maximally even sets in the music theory literature, where it was originally introduced in the context of pitch-class sets (chords and scales) by Clough and Douthett [42]. The first appearance of the Euclidean algorithm is in Propositions 1 and 2 of Book VII of Euclid’s Elements written circa 300 BC [43]. Given two positive integers, n and k, the Euclidean algorithm repeatedly subtracts the smaller number from the larger until either 1 or 0 is obtained. The greatest common divisor of the two numbers is 1 if the algorithm terminates with 1, and the number just preceding 0 if 0 is obtained. However, for the purpose of rhythm generation we are in fact not interested in calculating the greatest common divisor of the two numbers, but rather in the process by which the answer is obtained. In this setting n denotes the number of pulses (onsets and silent rests) in the rhythm, and k denotes the number of onsets (sounded pulses). The repeated subtraction process in the Euclidean algorithm is illustrated in Fig. 1 with \(n=16\) and \(k=5\). A similar implementation of the Euclidean algorithm was used by Bjorklund [44, 45] to design timing systems for spallation neutron source accelerators in the Los Alamos National Laboratory, that evenly distribute a specified number of electrical pulses within a given interval. In row (a) the 16 pulses are first organized so that the sounded pulses (here denoted by squares filled with black disks) fill the first 5 positions going from left to right, and the remaining 11 silent pulses (denoted by empty squares) fill the remaining positions. Since there are more empty boxes than filled boxes, 5 of them are “subtracted” and placed flush to the left under the remaining boxes, as in row (b). At this stage the “remainder” of 6 empty boxes is still larger than 5, so a second subtraction is performed to yield the pattern in row (c). This process terminates when the remainder consists of a single column of boxes shorter than the others, such as one box in row (c), or an empty column. The generated rhythm is then obtained by reading row (c) in a top-to-bottom and left-to-right fashion, as illustrated in rows (d) and (e). The rhythm obtained in row (e) with \(n=16\) and \(k=5\) has inter-onset intervals (IOI) 33334, and is the signature rhythm of electronic dance music (EDM) [46], and one of the ways the shamans on the east coast of South Korea subdivide a 16-pulse cycle in their ritual drumming music [47]. Since the type of rhythm considered here is cyclic, and thus repeats throughout a piece of music, it is also useful to consider rhythm necklaces consisting of all rotations of a given rhythm. Note that in the EDM rhythm the long interval occurs at the end. On the other hand, the rhythm heard on the piano of Radiohead’s recent song ‘Codex’ places the long IOI at the start of the pattern to obtain 43333 [48]. Furthermore, there are traditional rhythms that situate this interval at other locations in the cycle. For example the bossa-nova rhythm from Brazil has IOI = 33433 [49].

Fig. 1
figure 1

The rhythm obtained by the Euclidean algorithm with \(n=16\) and \(k=5\)

Given the two positive integers \(n=16\) and \(k=5\), the Euclidean algorithm terminates with a remainder of 1, establishing that the numbers 16 and 5 are relatively prime. Two integers are relatively prime if there exists no integer greater than 1 that divides both. On the other hand, with \(n=16\) and \(k=4\) the remainder is 0, the arrangement of boxes forms a \(4 \times 4\) rectangle yielding the regular rhythm [x . . . x . . . x . . . x . . .], a house kick drum (four-on-the-floor) pattern [46]. Therefore the Euclidean algorithm generates regular rhythms as well. However, the most interesting rhythms are obtained when n and k are relatively prime numbers [14, 31, 32, 40, 50]. In addition, if the starting point of the cyclic rhythm is not important and all rotations are included in the set, then these rotations are known as Euclidean necklaces. If mirror reflections are also included in the set then the set is referred to as a Euclidean bracelet [14].

Fig. 2
figure 2

The rhythm obtained by the Euclidean algorithm with \(n=12\) and \(k=5\)

Fig. 3
figure 3

The rhythm obtained by the Euclidean algorithm with \(n=8\) and \(k=5\)

By varying the values of n and k one may generate scores of Euclidean rhythms that are used in traditional music all over the world. The number n is generally smaller than 24 [51]. Usually the value of k is between one fourth and one half that of n. The most frequent values of n the world over are 4, 6, 8, 12, 16, and 24. When n is 8, 12, or 16, a popular value of k is 5. Figure 2 depicts the Euclidean algorithm at work with \(n=12\) and \(k=5\). The resulting rhythm with pattern [x . . x . x . . x . x .] is the Venda clapping pattern of a South African children’s song [31]. As a final example consider the case when \(n=8\) and \(k=5\) pictured in Fig. 3. The resulting rhythm with pattern [x . x x . x x .] is a rhythm found in the music of many cultures around the world, known in Cuba as the cinquillo pattern [52]. When it is started on the second onset it is the Spanish tango [53] and a thirteenth century Persian rhythm, the al-saghil-al-sani [37 ] .

The Euclidean algorithm described above, based on repeated subtraction, generates rhythms that are maximally even sets [42], in the sense that the IOIs of the rhythms obtained are distributed as evenly as possible in the necklace cycle. Maximally even rhythms may also be generated by means of a simple geometric process that consists of snapping real numbers to integers in a \(d \times n\) grid of squares, as illustrated in Fig. 4 for the case \(n=16\) and \(k=5\). The vertical y-axis denotes the number of onsets desired in the rhythm, whereas the horizontal x-axis denotes the units of time at which the onsets should occur. First connect the lower left corner of the \(d \times n\) grid to the upper right corner with a straight line. This diagonal line intersects the horizontal dashed lines at equally spaced x-coordinates. The first intersection is at \(x=16/5=3.2\), the second intersection at \(x=2(16/5)=6.4\), and so forth. The final step involves “snapping” these intersection points to their next lower integer (unless they happen to already have an integer x-coordinate. The resulting rhythm has IOI pattern 33334, the electronic dance music rhythm (EDM) [46]. Alternately one can “snap” the intersections to the next higher integer to obtain the IOI pattern 43333, a rotation of 33334. It is also possible to implement the “snapping” algorithm on a circular lattice. For the case of \(n=16\) and \(k=5\) the circle is first divided into a circular lattice of 16 equidistant points. On this lattice place an inscribed regular pentagon with one of its vertices on the first lattice point. Finally the remaining four vertices of the pentagon are snapped to the their nearest counter-clockwise integer lattice point, unless they are located on a lattice point.

Fig. 4
figure 4

Generating a maximally even rhythm by the snapping algorithm with \(n=16\) and \(k=5\)

Since the discovery that the Euclidean algorithm generates almost all the most popular rhythms that occur in traditional music all over the world in such a simple fully automatic manner, and can in addition generate “good” new rhythms that seem not to have appeared before in traditional music, by specifying unusual numbers for n and k, it has been frequently implemented electronically, and is now available in a variety of commercial open-source hardware sequencers such as Ableton Live [54]. Sequencers for generating Euclidean rhythms have also been applied to distributed multi-robot systems (swarm robotics) in which the motions of the robots control a group of Euclidean rhythms played concurrently [55].

3 Almost Maximally Even Rhythms and the Snapping Algorithm

For given values of n and k the Euclidean algorithm generates only a single “good” rhythm, which for \(n=16\) and \(k=5\) is the EDM rhythm [x . . x . . x . . x . . x . . .]. However, there exist other “good” rhythms with \(n=16\) and \(k=5\) used in traditional world music, such as the distinguished clave son: [x . . x . . x . . . x . x . . .] [12], which although not maximally even, are close to being maximally even. This motivates the generalization of the concept of maximally even, in order to obtain a simple deterministic algorithm that captures these additional “good” rhythms found in practice. There exists a plethora of mathematical possibilities for defining rhythms that are approximately maximally even. For example, one can define a measure of the distance between any rhythm with say \(n=16\) and \(k=5\), such as the edit distance [56], and consider a rhythm to be approximately even if the edit distance between the rhythm in question and a maximally even rhythm with \(n=16\) and \(k=5\) is below a specified threshold.

Fig. 5
figure 5

The nearest pulse directed acyclic graph (NP-DAG) obtained with \(n=16\) and \(k=5\)

Fig. 6
figure 6

Almost maximally even rhythms with \(k=5\) and \(n=16\)

The algorithm for generating maximally even rhythms with the snapping algorithm on the grid illustrated in Fig. 4 suggests a natural generalization of maximally even rhythms by permitting each intersection point to be “snapped” to either its left (floor function) or right (ceiling function) nearest integer (pulse). This generalized “snapping” algorithm is conveniently described as a traversal in a nearest pulse directed acyclic graph (NP-DAG) constructed as follows (refer to Fig. 5). The source vertex of the NP-DAG is the lower left corner of the grid that corresponds to the occurrence of the first onset at time zero. Directed edges are connected from the source vertex to both the left and right nearest integer pulse locations (vertices) corresponding to the first intersection point of the diagonal line with the dashed line of the second onset. This process is continued from the two vertices created, connecting directed edges to the two vertices determined by the succeeding intersection point. Finally the last two vertices are connected to the upper right target vertex, which corresponds to the starting onset at time zero. In this NP-DAG every path from the source vertex to the target vertex corresponds to an IOI pattern along the x-axis and thus a generated rhythm. The rhythms generated with this algorithm are termed almost maximally even. Since the vertices of this DAG other than those corresponding to the last intersection point of the diagonal at level 5, have degree 2, the number of distinct paths from the source vertex to the target vertex is \(2 \times 2 \times 2 \times 2 = 16\). Therefore for \(n=16\) and \(k=5\) there are sixteen almost maximally even rhythms. These sixteen rhythms are shown in box-notation in Fig. 6. Note that among this collection are present eight well known traditional rhythms (shaded) including the clave son, and a rotation of the gahu rhythm which has IOI pattern 33442 [57]. Note also that rhythms No. 1 and 9 are a rotations of the samba or EDM rhythm as well as the bossa-nova and its variant, and rhythm No. 11 is a rotation of the clave son. Furthermore, rhythm No. 5 is a rotation of the mirror image of the clave son. Therefore the notion of almost maximally even is a much more encompassing characterization of “good” rhythms than the stricter definition of Euclidean maximally even rhythms, and includes some, but not all, the rotations and mirror images of the traditional rhythms used in practice, suggesting that some of these transformations of “good” rhythms also produce “good” rhythms. Recall that if a rhythm is maximally even, then all its rotations and mirror images are also maximally even. However, not all the rotations or mirror images of an almost maximally even rhythm are almost maximally even. For example the clave son has an IOI of length 2, but none of the sixteen almost maximally even rhythms start with an IOI of length 2.

Fig. 7
figure 7

Almost maximally even rhythms with \(k=5\) and \(n=12\)

Although the unshaded rhythms in Fig. 6 do not appear to be used in traditional music, and are thus not “good” according to the definition used in this study, this does not imply that they would not be considered “good” rhythms by present-day musicians. Indeed, as has already been pointed out in the preceding, rhythm No. 1 with IOI pattern 43333, which is a rotation of the EDM rhythm, is used by Radiohead. Also, a rotation of the clave son by 180 degrees when viewed on a circle, or equivalently, starting the rhythm on the silent pulse No. 8, yieds the rhythm [. . x . x . . . x . . x . . x .], which is a popular way to play the rhythm in salsa music [58]. Aesthetic judgments in general, and of the “goodness” of a musical rhythm are of course partly dependent on cultural upbringing and musical experience [59]. Hannon et al. provide evidence that supports the hypothesis that culture-dependent familiarity of musical meter has a significant influence on rhythmic pattern perception [60]. There is also explicit evidence that language has an influence on the rhythmic aspects of music composition, and implicitly on the perception of musical rhythm [61]. To the author, all 16 almost maximally even rhythms in Fig. 6 sound good, although some are less familiar than others.

The 16 almost maximally even rhythms with \(k=5\) and \(n=12\) are shown in Fig. 7. Note that as with \(k=5\) and \(n=16\), half of the rhythms generated by the NP-DAG algorithm (shown shaded) are well established traditional rhythms used in practice in Sub-Saharan Africa, Andalusia in Southern Spain, and Cuba [14]. A noteworthy feature that distinguishes the rhythms used in practice from the other eight (unshaded) is the absence of two onsets located in adjacent pulses. None of the former have an IOI = 1, and all but one (No. 13) of the latter contain an IOI = 1. Due to the decrease in available temporal space for 5 onsets to be distributed among 12 rather than 16 pulses, the NP-DAG algorithm creates these short IOIs, which appear to be an undesirable feature in the rhythms used in practice.

The sixteen almost maximally even rhythms obtained when the values of k and n are set to 5 and 8, respectively, are shown in Fig. 8. As with \(n=12\) and \(n=16\), more than half (ten) of the rhythms generated by the NP-DAG algorithm (shown shaded) are well established traditional rhythms used in practice in Rumanian folk music, vodou rhythms, Sub-Saharan Africa, Cuba, and the Arab world [14, 3638]. A noteworthy feature that distinguishes the rhythms used in practice from the other seven (unshaded) is the absence of two groups of contiguous onsets. None of the former contain one group of two contiguous onsets and one group of three continuous onsets. Due to the further decrease in available temporal space for 5 onsets to be distributed among 8 rather than 12 pulses, the NP-DAG algorithm tends to create fewer groups of onsets, whereas three groups appear to be preferred in practice. Another feature present in these rhythms is that some of them (Nos. 4, 11 and 12) contain only four onsets. Due to the fact that 5 is more than one half of 8, the snapping rule used in the NP-DAG algorithm sometimes creates “collisions” whereby the rightward-snapped onset and the leftward-snapped onset of two consecutive input onsets coincide, resulting in the loss of one onset. Nevertheless, the regular 4-onset rhythm No. 4 is used all over the world, and the irregular 4-onset rhythm No. 12 when started on the last onset has IOI = 2132, which is the Abitan vodou rhythm [62].

Fig. 8
figure 8

Almost maximally even rhythms obtained with \(k=5\) and \(n=8\)

Fig. 9
figure 9

Binarization from \(n=12\) to \(n=16\) (left), and from \(n=12\) to \(n=8\) (right)

Fig. 10
figure 10

Ternarization from \(n=16\) to \(n=12\) (left), and from \(n=8\) to \(n=12\) (right)

4 Mutating “Good” Rhythms

The NP-DAG algorithm for generating almost maximally even rhythms described in the preceding section is limited to generating, from one maximally even rhythm made up of n pulses, fifteen offspring rhythms with the same number n of pulses. However, with a slight modification the snapping algorithm may transform a “good” rhythm with n pulses into one with m pulses where \(n \ne m\). Such a modification, besides serving as a model of the trans-cultural evolution of musical rhythms, and as a fully automatic algorithm for generating additional “good” rhythms, also provides a tool for changing the meter or introducing metrical ambiguity during performances on the fly [6366]. This version of the snapping algorithm is most conveniently illustrated using concentric circular notation of cyclic rhythms [14, 67]. Figures 9 and 10 depict the algorithm for the most ubiquitous values of the number of pulses \(n=8, 12, 16\) and the number of onsets \(k=5\). The input rhythms are displayed as polygons composed of solid lines, and the output rhythms as polygons with dashed lines. The snapping algorithm is similar to the algorithm used to generate Euclidean rhythms, except that here the onsets on the input circle are snapped to selected pulses on the output circle. If an onset on the input circle is flush with a pulse on the output circle, then it does not move. Otherwise several possibilities exist: (1) the onsets may be snapped to their nearest clockwise neighboring pulse, (2) their nearest counter-clockwise neighboring pulse, or (3) simply to their closest neighboring pulse in either direction. In Figs. 9 and 10 the nearest clockwise rule is used. Rhythms that are made up of 8 or 16 pulses (numbers divisible by 2 and not by 3) are here called binary rhythms, whereas rhythms with 12 pulses (divisible by 3) are here called ternary rhythms. The process of snapping a non-binary rhythm to a binary rhythm is called binarization [6466], whereas snapping a non-ternary rhythm to a ternary rhythm is called ternarization [63]. Figure 9 (left) shows the binarization of the ternary 12-pulse, 5-onset fume-fume rhythm (on interior circle) to a 16-pulse binary rhythm, the clave son (on exterior circle). The diagram on the right shows the binarization of the fume-fume to an 8-pulse binary rhythm, in this case the cinquillo. Note that binarizing a ternary Euclidean rhythm does not necessarily yield a binary Euclidean rhythm. The fume-fume rhythm is Euclidean, and so is the cinquillo, but the clave son is not, although it is almost maximally even.

Figure 10 (left) shows the ternarization of the binary 16-pulse, 5-onset clave son rhythm (on outer circle) to a 12-pulse ternary rhythm with IOI = 32313 (on inner circle). The diagram on the right shows the ternarization of the binary 8-pulse lundu rhythm (on outer circle) to an 12-pulse ternary rhythm with IOI = 23133 (on inner circle). Note that in this case both output ternary rhythms are rotations of each other.

The algorithm for generating almost maximally even rhythms described in the preceding may be viewed as a method for transforming a single maximally even rhythm that is established as being “good” according to our definition of “good,” to a larger family of rhythms that are expected to be “good,” by means of small local changes to the maximally even rhythm, in the form of minimal shifts of onsets, while maintaining the even distribution of the onsets in the rhythmic cycle as much as possible. These small changes fall into the much broader category of rhythm mutations. Mutations are typically defined in a biological context involving a modification of a DNA molecule that is modeled as a sequence of symbols each of which may take on one of four values. In the present context a rhythmic mutation is defined broadly as a transformation of one binary sequence to another. It is useful to distinguish between local and global transformations . A global transformation is guided or constrained by one or more properties of the rhythm as a whole, such as maintaining maximal evenness or almost maximal evenness, or transforming a binary rhythm to a ternary rhythm (or vice-versa). On the other hand, local transformations are implemented by local rules that may disregard their effect on global structural properties. Intuition suggests that a natural simple local rule for generating “good” rhythms is to make small judicious changes to existing “good” rhythms. One possible method is simply to take an established “good” rhythm such as a maximally even Euclidean rhythm or a ubiquitous non-Euclidean rhythm that has withstood the test of time, such as the clave son, and shift one or more of its onsets (other than the first) in either direction by one or more pulse positions. Application of this rule to the maximally even (Euclidean) EDM rhythm with the minimal restrictions that only a single onset may be shifted by only one pulse position minimal onset shifting (MOS) rule, yields the eight mutations shown in Fig. 11, four of which (shown shaded) are rhythms used in practice. Rhythm No. 2 may be viewed as the clave son run backwards starting at the last onset, or as the clave son run forwards starting at the third onset. The unshaded rhythms all sound good and it would not be surprising to find them used in practice somewhere, and thereby satisfy our definition of “good.” Rhythm No. 5 is a more syncopated version of a popular rap rhythm given by [x . . . x . . x . x . . x . . .] by virtue that the second onset in the rap rhythm is anticipated by one pulse. Rhythm No. 8 is also a more syncopated variant of the clave son obtained by anticipating the two last onsets.

Recall that the sixteen almost maximally even rhythms in Fig. 1 were generated by snapping each intersection point to its nearest left and right pulse positions. Note that all sixteen rhythms have the property that not one of their onsets is more than one pulse away from its nearest onset in the maximally even rhythm (No. 16). However, this does not imply that a rhythm obtained with a single shift of one of the onsets of a maximally even rhythm, by one pulse position, implies that the resulting rhythm is almost maximally even. Indeed, some rhythms in Fig. 11 are not almost maximally even, such as rhythm No. 8 which ends with an IOI of length 5, whereas no almost maximally even rhythm in Fig. 6 has such a long IOI.

Fig. 11
figure 11

Mutations of the maximally even rhythm obtained by shifting a single onset by one pulse

Application of the MOS rule to the distinguished “good” rhythm, the clave son, yields the eight mutations shown in Fig. 12, six of which (shown shaded) are used in practice. However, both rhythms numbered 4 and 7 are “good” rhythms as well. Rhythm No. 4 anticipates the second and third onsets of the shiko by one pulse each, making it more syncopated than the shiko. Rhythm No. 7 introduces hesitation on the last pair of adjacent onsets of the soukous by starting one pulse later, thus placing greater emphasis on the closing response portion of the rhythm. The two examples of the MOS rule applied to the EDM and clave son rhythms suggest that this method may be a viable alternative to the Euclidean and NP-DAG algorithms. In terms of computational complexity the MOS rule is certainly efficient once a “good” rhythm is given as input. However, compared to the Euclidean algorithm it requires too much memory (and concomitant search time) in terms of a table of existing rhythms, whereas the Euclidean algorithm requires no knowledge of any existing rhythms, generating rhythms automatically by merely varying n and k. Furthermore, comparing the MOS rule with the NP-DAG algorithm, the former yields fewer “good” rhythms than the latter. Of course one could relax the MOS constraint that only one onset may be shifted by only one pulse position, thereby generating many more rhythms. However, then the property of maximal evenness will be grossly violated and the chance of generating good rhythms will dwindle.

Fig. 12
figure 12

Mutations of the clave son obtained by shifting a single onset by one pulse

A variety of other local mutation algorithms are possible that sometimes yield a “good” rhythm. However, they are rather ad hoc and thus lack generality and applicability. For example, an extremely simple rule is to just delete one onset from a “good” rhythm in the hope that the remaining rhythm is still “good.” Here deletion means replacement of an onset with a silent pulse. If the last onset of the clave son [x . . x . . x . . . x . x . . .] is deleted one obtains the rhythm [x . . x . . x . . . x . . . . .] which is often heard in practice and is therefore “good.” However, deleting the third onset of the clave son yields [x . . x . . . . . . x . x . . .], which is not a successful mutation. So an algorithm that uses this rule requires the solution of the difficult problem of finding a general rule to determine which onsets of any given rhythm may be deleted without losing “goodness.” Another approach is to change rhythms by some rule, and pass the resulting rhythms through similarity filters in the hope that admitting a rhythm that is similar to a “good” rhythm must also be “good.” Such methods depend on measures of similarity or distance between rhythms [56, 68]. However, the relationship between “goodness” and similarity (or distance) is not yet well defined, making it difficult to select an appropriate similarity measure that will guarantee good results. The edit distance , often used in music applications, is known to correlate well with human judgements of rhythm similarity [56], but this does not imply it also correlates with rhythm “goodness.” Assume for instance that a mutation of the clave son is accepted by a filter that uses the edit distance, if the distance is at most 1. Both of the above mutations obtained by deleting either the third or last onsets have edit distance 1 from the clave son, and yet one is “good” and the other is “bad.” Furthermore, this approach may incur a heavy computational burden, if the distance between a candidate rhythm and all the “good” rhythms stored in some table must be computed and compared to some acceptability threshold.

5 Conclusion

In contrast to the computationally complex randomized and probabilistic methods, outlined in the introduction, that are used to generate musical rhythms without any guarantees that the resulting rhythms are “good,” and with the requirement that parameters must be tuned by their designers in order to yield rhythms that are good enough, this chapter focused on two computationally efficient and conceptually simple deterministic algorithms that are guaranteed to generate “good” musical rhythms: (1) the Euclidean algorithm, which for specific numbers of pulses n and onsets k yields a single maximally even (Euclidean) rhythm, and (2) the NP-DAG (Nearest Pulse Directed Acyclic Graph) algorithm that generates a family of almost maximally even rhythms. It is argued that although other simple deterministic algorithms for mutating “good” rhythms to obtain new “good” offspring rhythms are easy to concoct, they fall short of the Euclidean and NP-DAG algorithms on several counts. They not only lack generality and applicability, but are less efficient in terms of memory requirements and computational complexity, and are not guaranteed to yield “good” rhythms without “human intervention,” the latter being one of the hallmarks of the field of computational aesthetics [2]. A word of clarification is in order here concerning the words “without human intervention,” regarding the selection of the values of the number of pulses n and the number of onsets k in either the Euclidean or the NP-DAG algorithms. Clearly, selecting n and k arbitrarily does not guarantee that these algorithms will always yield “good” rhythms. For instance, if \(n=128\) (as happens for some Indian talas) and k is too large (\(k=50\)) or too small (\(k=5\)) relative to n, then the resulting rhythms are guaranteed to be terrible. Are not n and k then, parameters that must be tuned in order to obtain good results, thus implying that the algorithms depend on human intervention in order to perform well? To clarify this seeming contradiction it helps to distinguish between parameters that must be tuned, and constraints that must be satisfied. The parameters that must be tuned in typical approaches to rhythm generation, such as genetic algorithms, use complicated fitness functions that depend on statistics compiled from music corpora, and that encapsulate parameters including frequencies of notes, saliency weights attached to notes, and relations between note duration intervals [29]. These parameters (including the weights) must be tuned by trial and error to yield good results. On the other hand, the Euclidean and NP-DAG algorithms assume that the values of n and k are selected so as to lie in the range of values found in existing styles of music practice, and therefore are musical constraints that must be satisfied, rather than parameters that must be tuned. Once these values are fixed, the rhythm generation is automatic and completely free of human intervention. In this sense these algorithms fall also in the area of aesthetic computing [3], which asks how the arts can influence computer generated aesthetic objects. The values of n and k that are used in musical traditions all over the world have evolved over many years, even millennia, and have been adopted as part of the artistic practices of different cultures, providing the artistic influence on the computational generation of “good” musical rhythms.