No problem - just going through and implementing various examples to find all the bugs in my code.
Todd Ingalls Associate Director School of Arts, Media and Engineering ame.asu.edu<http://ame.asu.edu> On May 19, 2023, at 6:30 AM, b...@ccrma.stanford.edu<mailto:b...@ccrma.stanford.edu> wrote: Ouch! I optimized formant-bank at some point, and broke that instrument. I think this slower version works: (definstrument (move-formants start file amp radius move-env num-formants) (let* ((frms (make-vector num-formants)) (beg (seconds->samples start)) (dur (mus-sound-framples file)) (end (+ beg dur)) (rd (make-readin file)) (menv (make-env move-env :length dur))) (display dur) (newline) (let ((start-frq (env menv))) (do ((i 0 (+ i 1))) ((= i num-formants)) (set! (frms i) (make-formant (* (+ i 1) start-frq) radius)))) (do ((k beg (+ k 1))) ((= k end)) (let ((frq (env menv)) (sum 0.0) (inp (readin rd))) (do ((i 0 (+ i 1))) ((= i num-formants)) (set! sum (+ sum (formant (frms i) inp)))) (outa k (* amp sum)) (do ((i 0 (+ i 1)) (curfrq frq (+ curfrq frq))) ((= i num-formants)) (if (< (* 2 curfrq) *clm-srate*) (set! (mus-frequency (frms i)) curfrq))))))) (with-sound (:srate 22050) (move-formants 0 "oboe.snd" 2.0 0.99 '(0 1200 1.6 2400 2.0 1400) 4)) I need to figure out how to handle the original case -- the optimization moved all the filter innards into the some arrays in formant-bank, so setting the original formant fields had no effect on the formant-bank (oops... -- but it's faster!). Thanks very much for pointing this out!
_______________________________________________ Cmdist mailing list Cmdist@ccrma.stanford.edu https://cm-mail.stanford.edu/mailman/listinfo/cmdist