Genetic Wave Shaping
May 9th, 2007 by admin
Genetic Wave Shaping for Regenerating Timbre Characteristics in Synthesized Sound
Genetic wave shaping proposes a solution for the difficulties in digital sound synthesis to generate large quantities of variations on user specified timbre characteristics. The algorithm may prove useful in both music and music technology. It explores the concept of genetic algorithms and is generally designed for artistic purposes.
Evolutionary computation is receiving growing attention by researchers and artists working in the field of music and music technology. Biles developed a genetic algorithm that mimics a student learning jazz improvisation under the guidance of a teacher [1]. Roads used genetic algorithms for parameter regulation in granular synthesis [2]. Gibson devised the Neurogen system which uses genetic algorithms with a neural network controlling the fitness evaluation to generate algorithmic music [3]. Horowitz developed a genetic algorithm to generate large amounts of rhythmic material [4]. Johnson used interactive evolutionary algorithms to develop a computer system for sound design [5]. Garcia describes a method using genetic programming to explore the sound space of sound synthesis algorithms [6].
The genetic wave shaping algorithm described in this paper is a software experiment in sound synthesis based on the concept of genetic algorithms for automated sound design. The common underlying idea behind all these techniques is the same: given a population of individuals environmental pressure causes natural selection (survival of the fittest) and this causes a rise in the fitness of the population [7]. This population of individuals is a set of pseudorandom generated waveforms that, by crossover and mutation, converge towards a timbre model (optimal solution) derived from an example sound or set of sounds given by the user. Exploring genetic algorithms is particularly interesting for digital sound synthesis because of the capabilities it has to cope with difficulties in obtaining large quantities of sounds that possess user specified timbre qualities, and may even yield some unexpected results.
Characteristics of the genetic wave shaping algorithm are:
- Not only the fittest sound segments are useful for musical application, but also population members from previous generations.
- You can easily generate complex sounds.
- It is a relatively fast concept for generating large quantities of variations on a specific timbre type.
Fig. 1: Block diagram of the genetic wave shaping algorithm.
The genetic wave shaping algorithm takes the following steps (graphically depicted in Figure 1):
- Generate a population.
- Construct the timbre model based on the example sound and the initial population.
- Evaluate their fitness based on an example sound and the timbre model.
- Parent selection, select pairs of population members to crossover their genotypes.
- Crossover.
- Mutation.
- Evaluate their fitness based on an example sound and the timbre model.
- Survivor selection, the current population is replaced with a the new one.
- Check if the termination condition is satisfied. If not go back to step 3. If so, stop the algorithm.
The algorithm starts with the generation of a population of individual sounds. The individuals in the population are generated by a set of rules that can be specified by the user. These are weighting signal occurrences such as sine wave, square wave, noises, fractals, amplitude, frequency space and complexity rate. Also the size of the population can be set by the user. By setting these parameters manually, the user can direct the genetic algorithm to converge towards the timbre model faster or in a different manner.
The timbre model is constructed using a Kohonen neural network [8]. This is an unsupervised competitive learning algorithm that self-organizes into a feature map [9]. In the construction phase of the timbre model the neural network is trained with the initial population and the example sound. The neural network self-organizes into a feature map of arbitrary sound spectra. After the construction phase the timbre model can be used to measure the fitness of the population members by comparing the individuals sound spectrum to the sound spectrum of the winner vector from the timbre model. The main advantage of using the Kohonen neural network for timbre modeling is that if there are any spectral features they can be recognized even in noisy sound samples. This makes it easier to discover desired spectral features in the population members and narrows the search space of the genetic algorithm.
Parent selection is a vital part of the genetic algorithm, it selects two individuals from the population to crossover. Guiding on the one hand the convergence of the population towards a better overall fitness and on the other hand preventing the algorithm to stabilize at a certain fitness at an early stage by forcing it to somewhat explore other possibilities as well. The genetic wave shaping algorithm implements a commonly used concept in parent selection, fitness proportionate selection. In other words, the fitter the individual, the more chance it has to crossover with other individuals in the population, and thus producing more offspring. More precisely, an implementation of this concept named roulette wheel sampling is used. Which is conceptually equivalent to giving each individual a slice of a circular roulette wheel equal in area to the individuals fitness. The roulette wheel is spun, the ball comes to rest on one wedge-shaped slice, and the corresponding individual is selected [10].
After parent selection, crossover between the selected pairs takes place. Spectral material is selected using the connected component labeling algorithm [11]. By random picking connected components in the magnitude spectrum arbitrary segments in the spectrum are marked and used as a map for convolution filtering it’s own previous genotype. Adding both processed spectra from parent selection together the new spectrogram is resynthesized using an inverse Fourier transformation creating the offspring’s phenotype. While processing the crossover, mutation is introduced by merging randomly chosen signals with the offspring. The chosen mutation rate is equal to the amplitude and diversity of the mutation signal. Mutation is an important factor in the algorithm because it will cause the algorithm to keep exploring alternative possibilities and enables it to introduce new material into the population, which keeps the population ‘healthy’ by preventing the genetic algorithm to stabilize at a local optimum.
To evaluate the fitness of the individuals in the population a phenotype to genotype encoding is introduced. This is done by decomposing each individuals signal vectors into a continuous spectrum of its frequency components using a discrete Fast Fourier transform over time with a frequency space of 0 – 44100 Hz, 1024 bins and a Hanning window function [12]. The resulting magnitude spectrogram is fed into the timbre model. The weighted distance from the output of the timbre model to the magnitude spectrum of the example sound and the weighted distance from the offspring to the example sound is the fitness score of the individual. Based on the individuals fitness, only the fittest individuals are used in the next iteration. Removing bad individuals causes the overall fitness to rise.
At the end of each iteration the termination condition is evaluated. When the specified amount of generations have passed or at least one sound sample is generated with a fitness score within a user specified range the algorithm stops, otherwise the algorithm continues with the next generation.
References
[1] J. Biles. A genetic algorithm for generating jazz solo’s. The language of electro acoustic music, pages 61-93, 1990.
[2] P. M. Gibson and J. A. Byrne. Neurogen, musical composition using genetic algorithms and cooperating neural networks. Second international conference on artificial neural networks, 1991.
[3] C. Roads. Genetic algorithms as a method for granular synthesis regulation. Proceedings of the 1993 computer music conference, 1994.
[4] D. Horowitz. Generating rhythms with genetic algorithms. Proceedings of the 1994 computer music conference, pages 142-143, 1994.
[5] G. C. Johnson. Exploring the sound-space of synthesis algorithms using interactive genetic algorithms. Proceedings of the AISB workshop on artificial intelligence and musical creativity, 1999.
[6] E. A. Garcia. Evolving sound synthesis algorithms. Submitted to IEEE Waspaa 2001, 2001.
[7] A. E. Eiben and J. E. Smith. Introduction to evolutionary computing. Springer, 2003.
[8] G. De Poli and P. Prandoni. Sonological models of timbre characterization. Journal of new music research 26, page 170 - 197, 1997.
[9] J. Hertz, A. Krogh and R. G. Palmer. Introduction to the theory of neural computation. Westview press, 1991.
[10] M. Mitchell. An introduction to genetic algorithms. MIT press, 1996.
[11] M. Jankowski and J. Kuska. Connected components labeling – algorithms in Mathematica, Java, C++ and C#. New Ideas in Symbolic Computation: Proceedings of the 6th International Mathematica Symposium, 2004.
[12] S. Tempelaars. Signal processing, speech and music. Routledge, 1996.