Mercurial > hg > amuse
diff tools/segmentation/simple-example.lisp @ 77:edc6633e09ce
simple-segmenter fix
darcs-hash:20070713151502-f76cc-1b07f4a06f41a75100d05278bdded9d34265e12c.gz
author | David Lewis <d.lewis@gold.ac.uk> |
---|---|
date | Fri, 13 Jul 2007 16:15:02 +0100 |
parents | 6b2ac9eef629 |
children | 14e32f4d61d0 |
line wrap: on
line diff
--- a/tools/segmentation/simple-example.lisp Fri Jul 13 12:39:49 2007 +0100 +++ b/tools/segmentation/simple-example.lisp Fri Jul 13 16:15:02 2007 +0100 @@ -54,7 +54,7 @@ &key (rounding-divisor 1/4)) ;; FIXME: (vaguely) assumes monody (let ((i-o-i-list) (i-o-i-secs-list) (real-time t) (prev) (i-o-i-period) - (hits (make-array (1+ (/ 32 rounding-divisor)))) + (hits (make-hash-table)) (modal-value) (modal-count 0)) (sequence:dosequence (event composition) (when prev @@ -66,12 +66,13 @@ (setf real-time nil))) i-o-i-secs-list))) (setf i-o-i-list (acons event (duration i-o-i-period) i-o-i-list)) - (when (and (< (round (duration i-o-i-period) rounding-divisor) 32) - (> (round (duration i-o-i-period) rounding-divisor) 0)) + (when (> (round (duration i-o-i-period) rounding-divisor) 0) ;; larger than 32 crotchets doesn't really count as a useful ;; i-o-i for our purposes (or am I just doing this because - ;; I'm using an array. - (incf (aref hits (round (duration i-o-i-period) rounding-divisor))))) + ;; I'm using an array). + (if (gethash hits (round (duration i-o-i-period) rounding-divisor)) + (incf (gethash hits (round (duration i-o-i-period) rounding-divisor))) + (setf (gethash hits (round (duration i-o-i-period) rounding-divisor)) 1))) (setf prev event)) (loop for i downfrom (1- (length hits)) to 0 ;; we want the highest mode if there are several