program mixmidi: technical comments To mix midi files, events must be first grouped together. The approach adopted here is data clustering, a topic in statistics. This is a very general method. In the past, researchers have used sequence alignment algorithms instead. (eg. Edward Large, Matching Performance to Notation) The advantage of the present approach is that it naturally handles more than two performances. The main clustering subroutine is named JCLUST. Modulo arithmetic is used to calculate distances on the circle of fifths. A pitch value should be entered twice for each event: as MIDI note number (pitch proximity), and as MIDI note number times 7 with modulo 12 set (circle-of-fifths proximity). This is a trick: d = (7 @ (n1 - n0)) % 12 Where d is the circle-of-fifths distance and n1 and n0 are MIDI note numbers. This equation is effective for some reason having to do with a fifth being seven half-steps. hclust Hclust is a data clustering routine based on the method of partial sorting. Instead of choosing one value and sorting each element of an array as greater or less than it, choose two points to define a partition. Each other point is assigned its place based on which of the two points it is nearer. tclust This is a mixture decomposition scheme based on supposing that the data can be fit to a Student t distribution. Each object is assigned to a cluster in proportion to the probability that it was drawn from that cluster. Stable sorting Radix sort RSORTI sorts integers and carries along an index array. For long lists of short numbers, it is moderately quicker than quicksort. Merge sort MSORTR sorts reals and carries along an index array.