Hi, It seems make-bandpass doesn't have the mus-xcoeffs feature as general make-filter does, but I was trying to get the numbers to do some comparisons all in one definstrument, define, or let. It seems calling the make-bandpass function as a generator and trying to place the output into a vector is the wrong approach, or maybe I have the inp variable wrong? Also it seems one can use a bandpass or fir-filter call interchangeably?
How can I best get accurate xcoeffs numbers in-line, so to speak, from the make-bandpass gen? (define (gentest amp flo1 fhi1 order) (let ((flt1 (make-bandpass (hz->radians flo1) (hz->radians fhi1) order)) ;flow, fhigh, order (v (make-float-vector order)) ) (do ((l 0 (+ l 1))) ((= l order)) (float-vector-set! v l (bandpass flt1 l)) ;or (fir-filter flt1 l) (format #t "~%l: ~F bandpass: ~0,6F v: ~0,6F" l (bandpass flt1 l) (v l)) ) )) (with-sound (:srate 48000 :channels 2 :header-type mus-riff ) (gentest .5 200 400 3 ) ) As a test, I modified make-bandpass from dsp.scm to be able to print the coeffs which makes me believe the float-vector-set! approach above doesn't give the coeffs I was hoping to see. (define (mymake-bandpass flo fhi order) (let* ( (len order) (arrlen (+ 1 (* 2 len))) (arr (make-float-vector arrlen)) ) (do ((i (- len) (+ i 1))) ;-len to +len ((= i len) (make-fir-filter arrlen arr)) ;order xcoeffs (let* ((k (+ i len)) (denom (* pi i)) (num (- (sin (* fhi i)) (sin (* flo i))))) (set! (arr k) (if (= i 0) (/ (- fhi flo) pi) (* (/ num denom) (+ .54 (* .46 (cos (/ (* i pi) len))))))))) (do ((l 0 (+ l 1))) ((= l arrlen)) (format #t "~%l: ~F xcoeffs: ~0,6F" l (arr l)) )) ) (mymake-bandpass (hz->radians 200) (hz->radians 400) 3) Thank you for any suggestions, Jim
_______________________________________________ Cmdist mailing list Cmdist@ccrma.stanford.edu https://cm-mail.stanford.edu/mailman/listinfo/cmdist