<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
Hi,</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
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.&nbsp; 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?&nbsp; Also it seems one can use a bandpass or fir-filter call interchangeably?</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
How can I best get accurate xcoeffs numbers in-line, so to speak, from the make-bandpass gen?<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
(define (gentest amp flo1 fhi1 order)
<div>&nbsp;(let ((flt1 (make-bandpass (hz-&gt;radians flo1) (hz-&gt;radians fhi1) order)) ;flow, fhigh, order</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(v (make-float-vector order))</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;)</div>
<div>&nbsp; &nbsp;(do ((l 0 (+ l 1))) </div>
<div>&nbsp; &nbsp; &nbsp; &nbsp;((= l order))</div>
<div>(float-vector-set! v l (bandpass flt1 l))&nbsp; ;or (fir-filter flt1 l)&nbsp; <br>
</div>
<div>(format #t &quot;~%l: ~F bandpass: ~0,6F v: ~0,6F&quot; l (bandpass flt1 l) (v l))</div>
<div>&nbsp; &nbsp; ) )) &nbsp;</div>
<div><br>
</div>
<div>(with-sound (:srate 48000 :channels 2 :header-type mus-riff )</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(gentest .5 200 400 3 ) </div>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; )</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
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.<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
(define (mymake-bandpass flo fhi order)
<div>&nbsp; &nbsp;(let* (</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (len order)</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (arrlen (+ 1 (* 2 len)))</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (arr (make-float-vector arrlen))</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; )</div>
<div>(do ((i (- len) (+ i 1))) ;-len to +len</div>
<div>&nbsp; &nbsp;((= i len)</div>
<div>&nbsp; &nbsp; (make-fir-filter arrlen arr)) ;order xcoeffs</div>
<div>&nbsp;(let* ((k (+ i len))</div>
<div>(denom (* pi i))</div>
<div>(num (- (sin (* fhi i)) (sin (* flo i)))))</div>
<div>&nbsp; &nbsp;(set! (arr k)</div>
<div>&nbsp;(if (= i 0)</div>
<div>&nbsp; &nbsp; &nbsp;(/ (- fhi flo) pi)</div>
<div>&nbsp; &nbsp; &nbsp;(* (/ num denom) </div>
<div>(+ .54 (* .46 (cos (/ (* i pi) len)))))))))</div>
<div>&nbsp; &nbsp;(do ((l 0 (+ l 1))) </div>
<div>&nbsp; &nbsp; &nbsp; &nbsp;((= l arrlen))</div>
<div>(format #t &quot;~%l: ~F &nbsp;xcoeffs: ~0,6F&quot; l (arr l))</div>
<div>&nbsp; &nbsp; )) )</div>
<div><br>
</div>
(mymake-bandpass (hz-&gt;radians 200) &nbsp;(hz-&gt;radians 400) 3)<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
Thank you for any suggestions,</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
Jim<br>
</div>
</body>
</html>