Örjan Sandred


The current implementation of the Cluster Engine is part of the MOZlib package for Max. MOZlib can be found here (this installation includes the Cluster Engine implementation for Max).

The source code for the Cluster Engine is available on GitHub and can be used in any Lisp environment.


Composers frequently use computers as sketchpads while composing their music. By letting a computer immediately play back their score; they create an aural model of the performed music. Computer Assisted Composition (CAC) goes beyond this elementary use of computers. In CAC, computers solve basic tasks based on composers' instructions. In this way the computer becomes the composer's assistant.

I have been active in CAC since 1997 when I first approached rule-based computing techniques. I was met by comments that rule-based systems can be applied on structuring musical pitch, but that rules for rhythm are harder to formalize (i.e. less is said about rhythm in music theory). This challenged me and I started to create a system for rule-based composition exclusively for rhythm.

Since then, I have developed several constraint solving systems for music: OpenMusic Rhythmical Constraints (1998), Patch Work Musical Constraints (2005) and the Cluster Engine (2010).

The complex task of solving a musical Constraint Satisfaction Problem can be very demanding for a constraint solving system. Typically, when a system is trying to generate a polyphonic score that satisfy user-defined relations between rhythms and pitches over several voices, it gets stuck. The intricate network of dependencies that exist in a score makes it hard to develop a goodstrategy for how to find an acceptable solution. After having struggled with some of the existing constraint solving systems, it became necessary for me to develop a new, more efficient constraint solver that could handle more complex musical formalizations. I needed a system that could approach the problem from an angle where the nature of a music structure is taken into account. This became the starting point for the Cluster Engine.

The Cluster Engine uses several search engines that work in parallel. The order of how decisions are made by the system becomes more flexible, and also more efficient. One of the challenges has been how to guide the system during the search process: When several engines work semi-independent, it is a risk that the system misses to try some combinations of the elements. It is also a risk that the system re-tries combinations it already dismissed. Another challenge has been to solve how the system should backtrack when it needs to reconsider previous decisions in order to satisfy the given constraints.

The latest implementation of the Cluster Engine exists as an extension to Max ( unsing Julien Vincenot's MOZlib as a platform for calling Lisp functions from within Max.

Part 1

Part 2

Presentation of the Chained Cluster Engine and Julien Vincenot's MOZlib in Max at the virtual PRISMA meeting 2020.

An introduction to my research in rule-based computing in music composition at the IAST (Interactive Art, Science, and Technology in Western Canada) conference "Crossing Boundaries" 2018 in Lethbridge, Canada.

Research related articles and papers

Ö. Sandred. Constraint-Solving Systems in Music Creation.
in Handbook of Artificial Intelligence for Music, Springer, Switzerland, 2021: pp. xx-xx.

K.Fowler, Ö. Sandred and A.Whiteway. Acoustic perceptions of vessel fitness in southern Africa.
in Journal of Material Culture 22:3, xx-xx

Ö. Sandred. From Rhythm Rules to Music Rules
in Constraint Programming in Music, Iste Ltd, London, UK, 2011: pp. 197-237.

Ö. Sandred. PWMC, a constraint solving system for generating music scores.
inin Computer Music Journal 34:2, 8-24.

Ö. Sandred. Approaches to using rules as a composition method.
in Contemporary Music Review 28: 2, 149-165.

Ö. Sandred, M. Laurson and M. Kuuskankare.
Revisiting the Illiac Suite - a rule based approach to stochastic processes.
in Sonic Ideas/Ideas Sonicas 2 (2009): pp. 42-46.

M.Laurson, M. Kuuskankare, Ö. Sandred, and K. Kuitunen.
Statistical rules in constraint-based programming.
Proceedings of the International Conference on Auditory Display, 2009.

Ö. Sandred. Kalejdoskop for clarinet, viola and piano
in The OM Composer's Book - Vol.1, Editions Delatour France / IRCAM, 2006.

Ö. Sandred. Interpretation of everyday gestures - composing with rules
Proceedings of the Music and Music Science conference, Stockholm 2004.

Ö. Sandred. Searching for a rhythmical language
in PRISMA, vol.1, EuresisEdizioni, Milano, 2003.

Ö. Sandred. OMRC 1.1 A library for controling rhythm by constraints
IRCAM, Paris 1999.

Ö. Sandred. Tonsättaren och Datorn
in Nutida Musik, no.4 1996.

Ö. Sandred. Temporal Structures and Time Perception in the Music of Gérard Grisey:
some similarities and differences to Karlheinz Stockhausens's ideas
(Scanned paper,

3.7 MB) Montréal, 1994.