<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. 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?</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> (let ((flt1 (make-bandpass (hz->radians flo1) (hz->radians fhi1) order)) ;flow, fhigh, order</div>
<div> (v (make-float-vector order))</div>
<div> )</div>
<div> (do ((l 0 (+ l 1))) </div>
<div> ((= l order))</div>
<div>(float-vector-set! v l (bandpass flt1 l)) ;or (fir-filter flt1 l) <br>
</div>
<div>(format #t "~%l: ~F bandpass: ~0,6F v: ~0,6F" l (bandpass flt1 l) (v l))</div>
<div> ) )) </div>
<div><br>
</div>
<div>(with-sound (:srate 48000 :channels 2 :header-type mus-riff )</div>
<div> (gentest .5 200 400 3 ) </div>
)</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> (let* (</div>
<div> (len order)</div>
<div> (arrlen (+ 1 (* 2 len)))</div>
<div> (arr (make-float-vector arrlen))</div>
<div> )</div>
<div>(do ((i (- len) (+ i 1))) ;-len to +len</div>
<div> ((= i len)</div>
<div> (make-fir-filter arrlen arr)) ;order xcoeffs</div>
<div> (let* ((k (+ i len))</div>
<div>(denom (* pi i))</div>
<div>(num (- (sin (* fhi i)) (sin (* flo i)))))</div>
<div> (set! (arr k)</div>
<div> (if (= i 0)</div>
<div> (/ (- fhi flo) pi)</div>
<div> (* (/ num denom) </div>
<div>(+ .54 (* .46 (cos (/ (* i pi) len)))))))))</div>
<div> (do ((l 0 (+ l 1))) </div>
<div> ((= l arrlen))</div>
<div>(format #t "~%l: ~F xcoeffs: ~0,6F" l (arr l))</div>
<div> )) )</div>
<div><br>
</div>
(mymake-bandpass (hz->radians 200) (hz->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>