Algorithmic composition is a method that uses algorithms to create music. Algorithms, or sets of clear instructions, have been used to create music for centuries. For example, the rules used to plan how different musical parts work together in Western counterpoint can often be described as following specific steps. This term can describe methods that create music without continuous human help, such as using chance events. However, with live coding and other interactive tools, people can still have a major role in the process. Sometimes, composers use algorithms or data that aren't directly related to music as inspiration. Examples include fractals, L-systems, statistical models, and even data like census numbers, GIS coordinates, or magnetic field readings.
Models
Compositional algorithms are often grouped based on the programming methods they use. The results of these processes can be divided into two categories: 1) music created entirely by a computer and 2) music created with the help of a computer. Music is considered to be composed by a computer when the algorithm makes its own choices during the creation process.
Another way to classify these algorithms is by examining the type of output they produce. Some algorithms provide notational information, such as sheet music or MIDI files, for use by other instruments. Others generate sound directly without needing additional instruments. Some algorithms do both, creating both notational data and sound.
Compositional algorithms can also be categorized by their structure and how they process data. This classification includes six overlapping types:
• mathematical models
• knowledge-based systems
• grammars
• evolutionary methods
• systems that learn
• hybrid systems
This method of music synthesis involves converting information from a non-musical source, like a picture or text, into sound. The conversion can follow rules or use randomness. For example, a horizontal line in a picture might be turned into a constant pitch, while an upward-slanted line might become an ascending scale. Software often identifies concepts like height or sentiment from the original material and uses them to create music based on how music theory represents those ideas. Text can also be converted into music by analyzing its sentiment (positive or negative) using tools like sentiment analysis and translating that into musical elements, such as major or minor chords.
Mathematical models rely on equations and random events. A common method is using stochastic processes, which involve non-deterministic methods. In these models, the composer controls the process partially by setting probabilities for random events. Examples include Markov chains and Gaussian distributions. These methods are often combined with other techniques in decision-making processes.
Music has also been created using natural phenomena, such as fractals studied since the 1970s. These models use harmonic and inharmonic patterns found in nature to generate compositions.
An example of deterministic music using mathematical models is the On-Line Encyclopedia of Integer Sequences, which allows users to play integer sequences as 12-tone equal temperament music. Each number is converted into a note on an 88-key keyboard using a mathematical formula. Another example is the use of all-interval series in computer-aided composition.
One approach to creating music is to isolate the aesthetic rules of a specific genre and use them to generate new compositions. Knowledge-based systems use pre-defined rules or tests to create works in the same style or genre.
Music can also be viewed as a language with its own grammar. Compositions are created by first defining a musical grammar, which includes rules for elements like harmony and rhythm.
When creating well-defined musical styles, the process can be seen as solving a combinatorial optimization problem. The goal is to find the best combination of notes that minimizes an objective function, which contains rules of a particular style. These rules can be learned using methods like Markov models. Researchers have used various optimization techniques, such as integer programming and evolutionary methods, to generate music.
Evolutionary methods use genetic algorithms to create music. The composition is developed through an evolutionary process, with mutation and natural selection shaping the outcome. The algorithm eliminates less effective solutions and creates new ones from the remaining ones. A critic within the system ensures the quality of the final compositions.
Evolutionary methods combined with developmental processes form the evo-devo approach, used to generate complex musical structures. This method transforms simple compositions into more complex pieces through iterative steps.
Learning systems do not start with pre-existing knowledge about a genre. Instead, they analyze example material provided by users or programmers to create music similar to the examples. This method is connected to studies like algorithmic modeling of style, machine improvisation, and neural networks. For example, some systems use variable-length Markov models to learn musical motifs or use clustering techniques to analyze rhythm patterns.
Programs based on a single algorithm often fail to produce satisfying results. For this reason, hybrid systems combine multiple algorithms to improve outcomes. While hybrid systems offer new possibilities, they also become more complex and require more resources.
Another approach, called computer-assisted composition, involves using algorithms to create structures that are later completed manually. In the 1960s, Gottfried Michael Koenig developed programs to create aleatoric music, which was structured manually through performance instructions. In the 2000s, Andranik Tangian used a computer algorithm to design rhythmic patterns for compositions like Eine kleine Mathmusik I and Eine kleine Mathmusik II.