Genetic Algorithm Tool

« »
  • You have no permission to download this file.

  • Download Info

  • This tool implements an algorithmic composition technique based on Genetic Algorithms as originally developed by John Holland.  It does not create a composition, but drives a process over time whose evolution may be sonically interesting.  As with many things, it is all about the journey and not the destination, so interesting sonic events can occur as the algorithm moves toward its goal state.  This goal state and many parameters may be changed over time.

    Genetic Algorithms are a type of heuristic search, where a large search space is explored via a generate-and-test procedure. At each generation, a population of chromosomes are evaluated based on some fitness criterion. Based on this fitness criterion, pairs of chromosomes are selected for mutation and crossover, then added to the population.  In the context of heuristic search, this process continues until a suitable (but not necessarily optimal) solution is found. In our case, the goal is to hear the evolution. Chromosomes are a collection of pitches (6) which are played at each generation, with the fitness criterion being consonance: defined as a relationship to the reference frequency that is closest to ratios of small integers, with smallest integer ratios such as 2:1 and 3:2 being ideal.  This can also be inverted to seek dissonance.  As in the heuristic search application, selecting pairs of chromosomes for mutation and crossover also occurs.

    As expected, this process will converge on consonance at some point, but increasing the mutation and crossover probabilities as it runs can cause it to wander away, or the goal could be changed to dissonance for a different sonic direction.  Another way to drift away is by changing the reference frequency, either in the tool, or following some external source.

    This tool does not create sounds but changes event values as it runs along with an associated multigrid. !Freq1 !Freq2 !Freq3 !Freq4 !Freq5 !Freq6 event values reflect the contents of the 6 elements of each chromosome as it evolves, and are presumed to be associated with 6 tracks of an associated Multigrid. !RefFreq is used as a reference when evaluating the fitness of each chromosome and can be changed externally or in this tool.  If !RefFreq is changed, the genetic algorithm tool with reorient toward the new value, i.e. the !FreqN event values will begin to seek the new target.

    !Level1 !Level2 !Level3 !Level4 !Level5 !Level6 simply control the levels of each track by convention.  The associated Multigrid tracks are selected and triggered as appropriate during evolution.

    The display area shows a column for each chromosome with each of the 6 frequency components represented by a red bar at a height corresponding to its frequency, with brighter red indicating instantaneous fitness of a particular chromosome column.  The yellow arcs indicate the pairs of chromosomes selected at each generation.  The green box indicates the chromosome chosen to "play" at each generation, and is randomly chosen from among the more "fit" chromosomes that are the products of a previous generation.

    An associated Multigrid is provided as an example (GA-test.mgd). For pedagogical purposes, this Multigrid is fantastically boring, simply playing a voice using the !FreqN values described above.  You can, of course, do anything you'd like with these event values to savor the emergent sonic experience.

    See GA.kyt to get started.

    For usage, see the included notebook file: GA.kyt

    Enjoy the recombinant exploration!

    12/5/21, v1.7:

    1. increased frequency range parameters
    2. corrected fitness function behavior when Reference Frequency is above others
    3. increased mutation probability max to 0.5
    4. enabled playback frequency logging to a file - can be turned on by setting LogPlaybackFreqs to true.  File can be found in your home directory as flog.txt

    10/20/21: Updated for latest version of Kyma.  Added notebook documentation: GA.kyt


    Topic Posts Last Poster Updated
    Whoa. 1 JonBellona 8 years ago
    This Tool in performance at KISS2016 1 SSC 8 years ago