[CM] strange assertion failure and negative pitches with MOVING-SPECTRUM in snd 19.6

David O'Toole deeteeoh1138 at gmail.com
Wed Sep 4 05:33:38 PDT 2019

I'm experiencing strange troubles with detecting the loudest pitch in
a region via MOVING-SPECTRUM. (I am assuming that freqs[i] is the
loudest frequency when amps[i] is the loudest amp.) It outputs
negative pitches and also I get a strange assertion failure where the
loop counter becomes non-integer somehow:

(define (find-max-amp-index amps)
  (let* ((amp0 (find-max-amp amps))
(len (length amps))
(index 0))
    (do ((i 0 (+ i 1)))
((= i len))
      ;; how can this assertion possibly fail?
      (assert (integer? i))
      (when (>= (vector-ref amps i) amp0)
(set! index i)))

The repository includes the sound file and tests.
Full information is at the bottom of the source file:

I would greatly appreciate any help you can offer.

More information about the Cmdist mailing list