Page  288 ï~~PATTERN MATCHING.4 t THE COMPUTER SIMULATLI David Cc Professor of Music, I University of California, Abstract: This article presents pattern ma discovering a Mozart signature based on one c EMI (Experiments in Musical Intelligence) s' only requirement is that the reader use Comr these functions are meant to demonstrate basi not know LISP but wish to, the code may b, LISP text. This article-assumes that 1) pattern matching is a discover some of the reasons why composer's styles which occur in different works of a composer are va signatures; 3) re-using such signatures in music com voice leading can lead to replications in the style oJ C C S * * - 4 A,a

Page  289 ï~~By ear, one can quickly tell that the selections from t (beginning on the sixth note of the second example pattern continues until the last note of the second e' example. The pattern-matcher described here will r between the second and third examples is not so example, while resembling those of.the first two e) matcher, since the author does hear this as a variant, Code is described here as it was written: top-down. traditional LISP convention. There are four program (defvar *signatures* nil) (defvar *range-tolerance* 1) (defvar *error-tolerance* 0) (defvar *pattern-size* 5 The first is a location into which the results of the j the place where we will find the patterns that have m4 to the top-level function. The other three are what numbers which allow alteration of the process witho tolerance*, indicates the allowance for a possible - a

Page  290 ï~~(if (null (second note-lists)) nil (cons (- (second note-lists)(first note-lists)) (define-as-intervals (rest note-lists))))) "Decide-patterns" is a simple number cruncher whip into successive lists of *pattern-size* sub-lists. No data from the first part of the list, it recurses one possible *pattern-size* (here set to 3) lengthed p potential of creating redundancy in the process, it al seen in "signify-matches.";? (decide-patterns '(14 23 22 1 2 3 4 5 6 7)) 5)(4 5 6) (5 6 7)) (defun decide-patterns (work) (if (< (length work) *pattern-size*) nil ((14 (cons (butlast work (- (length work) *pattern-siz( (decide-patterns (rest, work))))), "Match" is the workhorse function of the program. 09 (mntnh '11"1 " I\(A C \\ '(') ' A\(Q 0 1(\\\ --((1 7 ) '.

Page  291 ï~~"Tolerate-errors" recurses through its first two argu incrementally if no match is found When *eror-t tolerance* has the value of 1 for the runs shown.;? (tolerate-errors '(1 2 3) '(1 2;? (tolerate-errors '(1 2 3) '(1 -2 -3) *error-tolerance*) -3) *error-tolerance*) (defun tolerate-errors (pattern-1 pattern-2 error-toleranc (cond ((null pattern-i) t) ((zerop error-tolerance) nil) ((eq (first pattern-1)(first pattern-2)) (tolerate-errors (rest pattern-1)(rest pattern-2) e (t (tolerate-errors (rest pattern-1,)rest pattern-2> "Signify-matches" counts the number of times a mot it as a list of the number plus the list. It then destr so that it will not repeat during recursion.;u (signify-matches ((1 1 1)(1 1 1))) _ ((2 (1 1 1))) I (defun signify-matches (match-list)