comparison utils/utils.lisp @ 132:bfe5afcad183

fix to monodiser darcs-hash:20070820144432-f76cc-29675eafe225b078be656eef11a6bff9dba70b81.gz
author David Lewis <d.lewis@gold.ac.uk>
date Mon, 20 Aug 2007 15:44:32 +0100
parents d2f68cedf573
children 5e362d998f29
comparison
equal deleted inserted replaced
131:995819f3a1d0 132:bfe5afcad183
236 (overlap (/ (duration (period-intersection event event-2)) 236 (overlap (/ (duration (period-intersection event event-2))
237 (min (duration event) (duration event-2))))) 237 (min (duration event) (duration event-2)))))
238 ;; only look at pairings for the shorter note. This can 238 ;; only look at pairings for the shorter note. This can
239 ;; have odd side effects, but means we never 239 ;; have odd side effects, but means we never
240 ;; under-represent an overlap (I think) 240 ;; under-represent an overlap (I think)
241 (when (>= overlap 3/4)
242 (return-from check-events-bag-for-polyphony T))
241 (when (or (not (aref overlaps shorter)) 243 (when (or (not (aref overlaps shorter))
242 (>= overlap (aref overlaps shorter))) 244 (>= overlap (aref overlaps shorter)))
243 (setf (aref overlaps shorter) overlap) 245 (setf (aref overlaps shorter) overlap)
244 (when (and (= shorter i) 246 (when (and (= shorter i)
245 (= overlap 1)) 247 (= overlap 1))
247 (return))))))) 249 (return)))))))
248 (let ((total 0) (overs 0)) 250 (let ((total 0) (overs 0))
249 (loop for i from 0 to (1- (length events-bag)) 251 (loop for i from 0 to (1- (length events-bag))
250 do (when (aref overlaps i) 252 do (when (aref overlaps i)
251 (incf total) 253 (incf total)
252 (when (>= (aref overlaps i) 3/4) 254 (when (>= (aref overlaps i) 1/2)
253 (incf overs)))) 255 (incf overs))))
254 (if (and (> total 0) 256 (if (and (> total 0)
255 (>= (/ overs total) 257 (>= (/ overs total)
256 1/4)) 258 1/4))
257 'T 259 T
258 'nil)))) 260 nil))))
259 261
260 (defgeneric inter-onset-intervals (composition &key rounding-divisor)) 262 (defgeneric inter-onset-intervals (composition &key rounding-divisor))
261 (defmethod inter-onset-intervals ((composition composition) &key (rounding-divisor 1/4)) 263 (defmethod inter-onset-intervals ((composition composition) &key (rounding-divisor 1/4))
262 ;; returns values - list inter-onset intervals in beats, modal i-o-i 264 ;; returns values - list inter-onset intervals in beats, modal i-o-i
263 ;; and i-o-is in seconds. 265 ;; and i-o-is in seconds.