To read this content please select one of the options below:

Creating melodies and baroque harmonies with ant colony optimization

Michael Geis (Bioinformatics Group, Department of Computer Science and Interdisciplinary Center for Bioinformatics, University of Leipzig, Leipzig, Germany)
Martin Middendorf (Parallel Computing and Complex Systems Group, Department of Computer Science, University of Leipzig, Leipzig, Germany)

International Journal of Intelligent Computing and Cybernetics

ISSN: 1756-378X

Article publication date: 6 June 2008




The purpose of this paper is to propose an algorithm that is based on the ant colony optimization (ACO) metaheuristic for producing harmonized melodies. ACO is a nature inspired metaheuristic where a colony of ants searches for an optimum of a function. The algorithm works in two stages. In the first stage it creates a melody. The obtained melody is then harmonized according to the rules of baroque harmony in the second stage. A multi‐objective version of the algorithm is also proposed, where each tier is optimized as a separate objective.


The ACO metaheuristic is adapted to graphs representing notes and chords. Desirability of a sequence of notes is measured by conformance to compositional rules. The fitness of a melody is evaluated with five equally weighted rules governing smoothness of the melody curve, its contour, tendency tone resolution, tone colors and the pitch of the final note. Harmonization is guided by six rules, grouped into three tiers of two rules each. These rules cover chord arrangement, voice distance, voice leading, harmonic progression, smoothness, and chord resolution. Rules of a tier do not score unless those of the previous tier yield high values.


The proposed algorithm improves on the only other existing musical ACO by adding the notion of harmony and by evolving voices codependently. The output is comparable to different types of other existing algorithms (genetic algorithm, rule‐based search algorithm) in the field. The multi‐objective variant significantly enhances solution quality and convergence speed, which makes extensions of the system for real time performance realistic.


This algorithm is the first ACO algorithm proposed for the problem of melody creation and harmonization.



Geis, M. and Middendorf, M. (2008), "Creating melodies and baroque harmonies with ant colony optimization", International Journal of Intelligent Computing and Cybernetics, Vol. 1 No. 2, pp. 213-238.



Emerald Group Publishing Limited

Copyright © 2008, Emerald Group Publishing Limited

Related articles