The first constraint states that inside a voice, a pattern a the correct number of onsets, that is, there are not two onsets at the same time. It can be written
, so that the pattern is not degenerated. We could eliminate this constraint by taking the durations as variables and removing
from the domains, but it would make the second constraint more complex (as a capacity constraint).
Second constraint, we must never hear two onsets at the same time, during a fixed duration
. It can be written : for two different voices,
, two onsets
and
and for all
such that
(the onset is repeated while it doesn’t exceed the duration),
An important parameter of this CSP is the average density of onsets. A density of
means that we hear in average one onset per two time units. Of course, it fixes the number of onsets by pattern, that is the number of variables for our CSP. There is obviously no solution when the density of onsets becomes too big.
Independently of the CP resolution, we can study this problem thanks to the Chinese Remainder Theorem. In a particular case with two voices, and only one onset by voice, the goal is to find
et
such that
This exactly the negation of the chinese theorem, ie solve
et
with
et
. So there exists a unique solution
in
, given by the formula
, where
and
are the Bezout coefficient of
and
, ie
. These two values are given, so we simply have to find
and
such that
, ie solve
It is possible to generalize to
voices, although it is unfortunately not the same generalization as the chinese theorem with
equations. Our goal is now to solve the system
for
.