30
Musical Applications of Constraint Programming using a Local Search Algorithm Charlotte Truchet Laboratoire d’Informatique de Nantes Atlantique Nantes University France

Musical Applications of Constraint Programming using a Local Search Algorithm Charlotte Truchet Laboratoire d’Informatique de Nantes Atlantique Nantes

Embed Size (px)

Citation preview

Musical Applications of Constraint Programming

using a Local Search Algorithm

Charlotte TruchetLaboratoire d’Informatique de Nantes

AtlantiqueNantes University

France

Overview

• Computer assisted composition and OpenMusic

• Modelling of musical CSPs• Adaptive search• OMClouds• Guitar

Computer Assisted Composition

Introduction

Computer Assisted Composition

• Common Music / StellaRick Taube, ZKM, Germany

• EMIDavid Cope, USA

• OpenMusicGérard Assayag, Carlos Agon, IRCAM, France

Introduction

OpenMusic, visual

Introduction

OpenMusic, object oriented

Introduction

Overview

• Computer assisted composition and OpenMusic

• Modelling of musical CSPs• Adaptive search• OMClouds• Guitar

Previous works

• Automatic harmonization: Ebcioglu 87, Tsang Aitken 91, Ballesta 98, Pachet Roy 01

• BOXES (Beurivé, Desainte-Catherine 01), Mosaïcing (Zils, Pachet 01), Pico (Rueda, Valencia 01), MusicSpace (Delerue 04)

• In OpenMusic: Situation (Rueda, Bonnet 90),PWConstraints (Laurson 96)

Modelling

Harmony, Georges Bloch

Modelling

Une empreinte sonore de la Fondation Beyeler (for ensemble)

Asynchronous rhythms, Mauro Lanza

• Variables: rhythmical patterns of fixed, relatively prime lengths L1 ... Ln

• Each pattern is played repetitively on one voice

• Constraint: not two onsets played simultaneously for a fixed duration D

No solution as soon as D >= lcm(Li , Lj) for any i, j

Modelling

Asynchronous rhythms, Mauro Lanza

Erba nera che cresci segno nero tu vivi (for voice and eletronics)Burgertime (for tuba end electronics)Aschenblume (for ensemble)

Modelling

Special features of these CSPs

Modelling

• Expressivity of the constraint language• Need for diverse solutions • Many overconstrained problems• Solutions are re-written afterwards• The resolution process has to be

understood by non-scientific users

Overview

• Computer assisted composition and OpenMusic

• Modelling of musical CSPs• Adaptive search• OMClouds• Guitar

Adaptive search

Adaptive search

• Local search method close to GSAT, WalkSAT, WSAT(OIP) Selman 92, Selman Kautz 94, Walser 99

• Min Conflict Minton 92

• Tabu-like heuristic Glover 89

• Shown to be very efficient on classical academic CSPs Codognet Diaz 03

Local search

Adaptive search

constraintX = Y

error function which measures how much the constraint is satisfied

| X- Y |

The goal is now to find a configuration with error zero.

Adaptive search

Adaptive search

constraintX = Y

error function which measures how much the constraint is satisfied

| X- Y |

projection on each variable

Intuitively

Adaptive search

• Directed search: the structure of the problem is usedat the variable levelat the constraint level

• Convergence on variables with bad values

• Any kind of constraint can be used, provided the appropriate error functions are defined

Overview

• Computer assisted composition and OpenMusic

• Modelling of musical CSPs• Adaptive search and musical application• OMClouds• Guitar

OMClouds

• Homogeneous variables• Three CSPs structures: lists,

permutations, cycles• Take advantage of existing musical

knowledge in OpenMusic• Visual definition of the constraints• By default, automatic transformation of

constraints into cost-functions• Edition of approximate solutions

OMClouds

OMClouds objects

OMClouds

asvarlistvaluesdomainscurrent errorstabu statusconstraints...

associated methods• update• initialize randomly• descent• resolution• ...

musical object associated methods• edit on a score• play• ...

OMClouds

instance of asvarlist

method for asvarlist

OMClouds

Variables

Constraint primitive

OMClouds

Edition ofpartial results

Overview

• Computer assisted composition and OpenMusic

• Modelling of musical CSPs• Adaptive search and musical application• OMClouds• Guitar

Guitar

C major chord : bass + third + fifth

Find a playable realization and the associated fingering

Guitar

5

Constraints for a single chord

• The guitarist uses only four fingers• or three in case of a barré, and then no note

can be played below the barré• The hand has a limited size, depending on the

position• If the mute is possible, then a minimum of

notes must be played• ad lib

Guitar

Constraints for two successive chords

• Minimize the number of cases in the position’s change

• Minimize the number of position changes• Maximize the number of fingers which stay on

the same note • In case of barrés, stay on the same barré

Optimize an ad hoc distance in order to combine all of these possibilities

Several possibilities:

Guitar

Guitar

Resolution

• Solved in two steps• first step : find all the solution for one chord

complete method• second step : find a tour in the solutions with

minimal erroradaptive search

• Visual integration to OM objects by adding the fingergings

Guitar

Chords from Mikhaïl Malt

• Musical application give new, original CSPs and shows a good example of non-academic use of CP

• CP is a flexible programming tool for the composers• OMClouds takes advantage of the whole search

process, and naturally copes with overconstrained CSPs

Conclusion