Page  1 ï~~AUTOMATIC FITNESS IN GENERATIVE JAZZ IMPROVISATION Kjell Bickman IT University Art & Technology dept. Gothenburg, Sweden ABSTRACT Recent work by the author has revealed the need for an automatic fitness function in the evolutionary algorithm for generation of jazz solos. A computer based automatic fitness function enables greater populations and a great number of generations within a manageable time. This paper describes how the automatic fitness function is implemented using score calculation based on specific events recognized in the solo line and alignment to different optimal intensity curves. 1. INTRODUCTION The most important feature of a good jazz musician is to be able to keep an entire solo together as an entity, i.e. to build up the solo phrase by phrase in collaboration with the other musicians, where each phrase is a natural continuation of the previous phrase and leads further to a climax of intensity. After the climax the solo should be rounded off. A longer solo might contain several climaxes, but they should then be organized in a musically meaningful way. A good improviser is not allowed to drop the focus and give way to meaningless cascades of tones or producing routine phrases for lack of artistic ideas. The challenge is to be able to plan the structure of the solo already from start, and then stick to the plan during the entire solo. There are some excellent examples in the history of jazz with this ability, such as John Coltrane, Miles Davis, Keith Jarrett, Bill Evans, Johnny Griffin and possibly some more. This paper builds upon the experiences of the Generative Jazz Improvisation experiment of making the computer build up a solo by means of the rubber band and operator tree principles. That project utilized a manual implementation of the fitness function, i.e. the user was obliged to listen through all sound examples in one generation and manually specify the two best to act as parents in the next generation. The problem here was to keep your concentration at the same high level. After listening to all melody examples in a couple of generations you got tired and felt a difficulty to be able to search for real musical quality in each melody. When listening to the 10th melody of a specific generation it was hard to remember melody no. 1, 2, 3 etc and estimate whether the 10th was better than the 3rd, for instance. During a listening session you might also be inclined to change your focus on what you actually are searching for. This project uses a computer based function for analysing melodies, giving them scores and selecting the melodies with highest score for breeding of the next generation. Dahlstedt [1] uses an automatic fitness function in his experiments in automatic composition. Since improvisation is equal to composition in real time, Dahlstedt's work has been a source of inspiration. 2. GENETIC EVOLUTION The evolutionary algorithms process starts by, from a basic set of parameters (genome), creating a first generation of pictures, melodies or whatever. The fitness function then takes place by examining the bred material (children) and selecting the best, optionally by giving each a score. The children with the highest score will most likely be parents for the next generation. The breeding is done by combining the genome (parameter values) of two parents, optionally by applying a mutation somewhere in the genome. The mutation might imply a shift between two parameter values, or a slight modification of a parameter value. The principle of using evolutionary algorithms to develop new artistic productions, enhance artistic thinking and stimulate creativity, first started on a broader scale in the digital graphics area. The evolutionary algorithms principle is well accommodated to that area because when using manual evaluation of a created generation, you can swiftly scan over a great number of pictures and select the best according to your personal preference. With audio material, however, the selection procedure is much slower since you will have to listen through each bred melody in a generation, one at a time. The fitness selection and breeding is repeated generation by generation until you arrive at a genome good enough to be used for reproduction of a specific artwork (picture / melody etc.). This process is much the same as the genetic process of creating a new species generation in nature, only that it must be sped up considerably to have a chance to be completed in proper time, for instance by means of computer based selection and breeding. The number of generations used for one evolution session must be limited, the calculation of parameter values must be optimized and efficient to allow for a rapid development

Page  2 ï~~towards a good genome, and the fitness function must be user friendly to minimize tedious manual intervention, unless this is performed by a computer. Do evolutionary algorithms provide any valuable artistic material? At least some sounding examples are of interest, maybe not of high professional musician class, but provide interesting and unexpected artistic output. An improviser often uses standard phrases and motives trained during a long time of practicing and concerting. He relies on routines built up through repeated usage of similar muscular movements that are well accommodated to the physical design of the instrument. Some musicians are very strongly tied up to this behaviour, which make them sound somewhat clich6 -like and ingeniously limited. There are some examples of this kind of musician in jazz history. They use the same kind of motives in different kinds of styles. They may sound technically very brilliant and swinging, but if you transcribe their solos and try to play them with a good fingering, you will realize that they are astonishingly easy to learn to play. The main purpose of using computer based support to produce jazz improvisation is that it opens your mind to new thinking and frees you from old habitual paces of thinking. Hopefully it can enrich your improvisation style with new kinds of musical material. 3. AUTOMATIC FITNESS The problem of building an automatic fitness function is obvious. How can we with computer code reflect things as sensibility, intensity, musicality, tension, expectation, climax, relaxation etc., i.e. concepts used by musicians and musicologists to describe a good improvisation solo. The problem must be broken down to the level of analysis of musical components like intervals, rhythm, motif repetition, melodic curves, polyphony, melodic heights etc., i.e. components more or less prevalent in the MIDI information of a melody. The analysis process must be capable of evaluating the found components and assigning points at different positions of the melody. This evaluation process is based on the tools and methods jazz musicians use to build up a solo and increase the intensity during the solo, both as regards * my own solo playing * tools I have been using in may own education of jazz musicians * experiences from listening to and analysing world famous jazz musicians The intensity is self-conserving to some extent. With this we mean that an intensity increase at a certain moment in a solo will not immediately get lost, but instead be kept to some extent for subsequent moments, however with diminishing strength (see fig. 1). Figure 1. An intensity increase event seems to stay in the listener's mind for some time. Thus, an intensity increase will stay for some time in the listener's ear and contribute to the build up towards the climax. 4. THE FITNESS EVALUATION PROCESS The fitness evaluation is carried out by a number of analysis functions, which contribute with points that are stored per tone of the melody. When all analysis functions have contributed with their points per tone, the points are aggregated per bar. At the end of the evaluation we have aggregated points per bar reflecting the intensity fluctuations of the melody. Since the intensity provided by a melody fragment tends to stay in the listener's ear for some time, the points per bar are examined once again and 50% of the intensity points for one bar are added to the points of the next bar. Thus each bar will contribute to the points of the next bar with half of its point value. The points per bar will have a graphic representation something like in fig. 2. Figure 2. Calculated points per bar during the solo, with 50% accumulation from the previous bar. Now, we take the points value of the 95% bar number, i.e. the point value of a bar at the near end of the melody, and construct an "optimal" intensity figure: Figure 3. Optimal intensity curve.

Page  3 ï~~For each bar we calculate the deviation from the optimal intensity figure: Figure 4. Deviation from the optimal intensity curve. The deviations per bar are added to arrive at a total deviation for the entire melody. The aim is to get as little total deviation as possible from the optimal intensity figure. In this description the optimal intensity figure is represented by a straight line up to the climax maximum point at the end of the solo. However, it is possible to design other optimal curves with several different climax points and other types of intensity fluctuations. In this project we will try different types of optimal curves. All children of one generation are compared with regard to the total deviation. The two children with the smallest total deviation, i.e. the two children which most perfectly align to the optimal intensity figure, will be selected as parents for the next generation. This is repeated for each generation; the analysis functions are performed to each child, points are aggregated per bar and the comparison to the optimal intensity figure is performed. This is repeated until the total deviation is small enough (a system parameter). The analysis functions are described below. 4.1. Density Density refers to metric aspects, i.e. the number of tones per time unit. Some young immature jazz musicians think that the faster you play the better musician you are. And it is dangerous to surrender to the conviction that the only tool by which to increase the intensity is the number of tones. However, a rapid sequence of short tones could in some situations be an efficient means of increasing the intensity, especially as a sudden cascade of short tones in an environment of long tones or rests. Therefore, density has been considered a candidate to intensity increase. The density function goes through each sequence of 5 tones and checks whether the average tone length is shorter than 48 MIDI ticks, which in this application corresponds to an eighth note. If so, a contribution of the difference between the average and 48 is given. 4.2. Rhythm The Rhythm function is a good complement to the density function since it pays attention to the contrast between short and long tones. The Rhythm function tests if in a series of 5 tones there is one long and several short tones, and gives contribution accordingly. A tone is considered long if the number of MIDI ticks is greater than 96, i.e. longer than a quarter note. A tone is considered short if the number of ticks is equal to or below 32, i.e. shorter than an eighth triplet. If the number of short tones equals 3 a contribution of 10 points is given. If the number of short tones equals 4 a contribution of 15 points is given. 4.3. Motif Repetition Repetitive occurrences of small melodic motifs tend to drive the improvised solo to higher intensity levels. The Motif Repetition function analyses the melody and tries to find a small motif that occurs also in the immediate future, maybe somewhat transposed or somewhat modified as concerns the intervals between the pitches. The two motifs to be compared must have about the same corresponding intervals. The interval deviation can be maximum 2 halftones, and the allowed deviation is increased by 1 halftone per each third tone. If a motif repetition is discovered a contribution of 5 points is given. 4.4. Chromatics Chromatic patterns have a tendency to make the improvised solo more interesting. The Chromatics function discovers any chromatic features built into the melody by checking each tone, each 2nd tone, each 3rd and each 4th tone. If there are three equidistant chromatic tones, a contribution is given. The contribution number of points is 5 times the distance number of tones. For instance, if a chromatic series of tones at the distance of 3 tones is discovered, the contribution will be 5x3 = 15 points. 4.5. Heights The Heights function has a similar approach as the Chromatics function. The Heights function however focuses on melodic heights. It checks for heights in consecutive phrases and whether the heights are chromatic. If the heights are upwards chromatic, a contribution of 8 points is given, and if downwards, 5 points. The reason for this is that a sequence of upward chromatic motifs provides a stronger pushing feeling than a downward movement.

Page  4 ï~~4.6. Polyphony Polyphony means at least two tones simultaneously. Jazz pianists sometimes use the method of pressing two keys simultaneously in an otherwise homophone melody to provide a harmonically and rhythmically interesting touch, which has an intensity elevating effect. As soon as polyphony is discovered a contribution of 10 points is given. 5. RESULTS The sounding output of the generated music examples has an obvious intensity curve indicating some kind of solo grand layout often used by professional jazz musicians. However, I must admit that the musical quality is not yet at a quality level worth listening to, at least not several times, but the music examples definitely have an interesting feature of intensity build-up and relaxation. The different types of optimal curves provide different intensity patterns, where the straight line option presents the best result as regards obvious intensity curve. The other optimal curves (single sine, double sine) do not show these obvious intensity curves, maybe depending on the length of the musical examples. A longer solo would probably be required to illustrate the effect. This has to be further investigated. We have experimented with different contribution points for the different functions, and acquired a point setting that seems to be optimal or near the optimal. The point setting is the one described for the various functions. A set of unaccompanied sound examples can be heard at this link in General MIDI format: http://oden.ei.hv.se/kjell/autofitness A link to an example with computer generated drums and bass accompaniment is also available: http://oden.ei.hv.se/kjell/autofitness/nidi evolvi.rnid An example of an orchestrated tune with virtual instruments and my own acoustic piano playing is available at this link: soloist, the drummer and the accompanying pianist "listen" to each other and reuse motives and rhythmic accents. Hopefully this will render not only a communicative feature but also a feeling of collective improvisation, where no particular soloist is leading the others but instead a situation where all musicians have the same value and contribute to the musical result on an equality basis. 7. REFERENCES [1] Dahlstedt, P. (2004) Sounds Unheard of - Evolutionary algorithms as creative tools for the contemporary composer. PhD thesis, Chalmers University of Technology, Gothenburg. [2] Bickman, K. (2008) A Generative Representation for the Evolution of Jazz Solos. In Proceedings of EvoWorkshop Conference 2008, Napoli. [3] Thywissen, K. (1996) GeNotator: An environment for investigating the application of generic algorithms in computer assisted composition. In Proceedings of International Computer Music Conference 1996 (ICMC96), pp. 274-277, Hong Kong. [4] Manning, P. (2004) Electronic and Computer Music. Oxford University Press, New York, USA. [5] Dean, T. (2003) Hyperimprovisation: Computer-Interactive Sound Improvisation. A-R Editions Inc.,Middleton, Wisconsin. [6] Rowe, R. (1993) Interactive Music Systems. The MIT Press, Cambridge, Massachusetts, USA. [7] Rowe, R. (2001) Machine Musicianship. The MIT Press, Cambridge, Massachusetts, USA. 6. FUTURE WORK Since the a final goal of this project is to use the generated melodies as improvised solos in jam sessions with both virtual instruments and acoustic instruments, it will be necessary to accommodate the rhythm to the beat of the tune being played, and also to the periodicity and chorus lengths. Evolutionary algorithms can also be used to produce new harmonies, drum rhythms, walking bass figures, piano and guitar accompaniment chord arrangement, and basic tune themes. This work has already been initiated, and will be published in the future. Communication between musicians is very important in live jazz music. It would be possible to implement this in a computer generated jam session by letting the