|Application domain:||Composing music|
|Further specification:||Data sets of positive and negative examples|
|Pointers:||Contact Uros Pompe uros.pompe@fri. uni-lj.si|
|Data complexity:||Three sets of positive examples (151, 316, 505) and three of negative examples (156, 2284, 19912)|
Figure 1: An example cantus firmus with the counterpoint
The problem of composing the two-voice counterpoint is therefore: for a given basic melody, called cantus firmus, write the second voice, i.e. the counterpoint, in such a way that the constraints of the two-voice counterpoint are satisfied. To be able to compose the counterpoint, one has to use negative rules that prohibit (many) incorrect counterpoints, and positive rules which guide the composing towards better counterpoints. Of course, ``better'' in music is rather a subjective characteristic which makes the learning of positive rules less defined and more fuzzy. Different composers use different positive rules (and often contradict negative rules) and create their own style of composing.
Learning the two-voice counterpoint was studied also by other researchers. Widmer (1988) uses context-free grammars to represent the relation between the basic melody and the counterpoint and uses also the advanced and complex background knowledge to learn the apprentice system. Dobnikar (1994) uses the manually coded set of rules in an expert system for composing the counterpoint. He preliminary studied also the use of ILP to learn the rules from training instances.
segment(CfNote, CpNote, PreCfNote, TargetPreCpNote)
bad(CfNote, CpNote, PreCfNote, TargetPreCpNote)
Figure 2: An example of the segment relation
'Cf' stands for cantus firmus and 'Cp' for counterpoint. The relation is illustrated with Figure 2. Predicate ``segment'' defines positive rules and predicate ``bad'' defines negative rules. The rules for the target predicates enable one to compose the counterpoint from cantus firmus and the ending note of the counterpoint (which satisfies the rules of ending harmoniousness) by iteratively applying the positive rules to complete the first non-completed note of the counterpoint starting from right to left with further restrictions dictated by negative rules. If the set of positive rules is empty or nondeterministic, all possible counterpoints are generated that do not satisfy the negative rules. Besides automatically generated negative rules, we used also the following rules from the musical theory to restrict the set of possible counterpoints for a given cantus firmus:
The background knowledge includes the basic musical knowledge:
Note that due to 4 arguments of the target predicate, each with 13 possible values, the complete space consists of instances. We had available a database from which we were able to generate up to 505 positive instances and up to 19.912 negative instances (Makse, 1994). The closed world assumption for the generation of the negative instances is inappropriate for two reasons in this case. First, not all the positive examples are given, and second, the domain itself is not crisp, there are examples which can not be classified as either positive or negative since sometimes the rules can be broken to emphasize more the artistic component of the counterpoint.
segment(A,B,C,D) :- not(is_interval1(B,A,_)), is_interval1(A,D,U1), not(is_interval1(A,C,U1)).We generated counterpoints for several tens of basic melodies. Counterpoints were generated in an exhaustive manner: all possible counterpoints that were allowed by at least one positive rule (segment) and were not covered by any negative rule (bad). These counterpoints were then evaluated by two professional musicians and three non-musicians.
For almost each of the counterpoints the musicians were able to detect a certain pitfall, mostly related to the problem of the ending of the counterpoint. Note that the ending sequence was not treated separately by our knowledge representation. However, non-musicians considered almost all counterpoints nice and only in few exceptional cases they were able to recognize the pitfalls that were discovered by the musicians.
As already stressed in Section 2, the quality of composing can be only subjectively evaluated. Overall, the professional musicians and non-musicians considered our system an acceptable junior composer.