[CM] make-bandpass

James Hearon j_hearon at hotmail.com
Fri Jul 1 10:52:50 PDT 2022

Yes. Understood.  That's very helpful information.  I see I can use mus-xcoeffs with make-bandpass.  I think I wasn't indexing it properly too.

If I might continue to ask, what are the numbers ouput from the generator, ex. (bandpass b)?

I know the xcoeffs are the filter magnitudes but when nothing is passing thru the filter yet, as it would be if one were to call (outa i  (b (* amp (oscil os)))),  what do the output numbers of the generator represent before the filter is applied to a source?  Are they random sample amplitudes, for ex.?

(let* ((b (make-bandpass (hz->radians 500.0) (hz->radians 2000.0) 3))
       (v (make-float-vector 3))
   (do ((l 0 (+ l 1)))
       ((= l 3))
;(float-vector-set! v l (bandpass b l)) ;what is output here?
(float-vector-set! v l ((mus-xcoeffs b) l)) ;filter magnitudes
(format #t "~%l: ~F v: ~0,6F" l (v l))
   (do ((l 0 (+ l 1)))
       ((= l 3))
(format #t "~%j: ~F  v: ~0,6F" l (v l))

...also (sorry this long-winded) when I see a lambda func adding the two bandpass filters, ex.

(flt3 (lambda (y) (+ (bandpass flt1 y) (bandpass flt2 y))))

I cannot get the mus-xcoeffs of flt3 then, because it's now a lambda function.
So my purpose was to prove to myself that the lambda func was indeed the same as adding two vectors of mus-xcoeffs.
(float-vector-add! v1 v2).
In other words trying to see the numbers to verify the lambda function is indeed adding the xcoeffs, not the generator outputs.
I hope that makes sense.  But I'm still failing in my proof.

From: cmdist-bounces at ccrma.Stanford.EDU <cmdist-bounces at ccrma.Stanford.EDU> on behalf of cmdist-request at ccrma.Stanford.EDU <cmdist-request at ccrma.Stanford.EDU>
Sent: Thursday, June 30, 2022 9:00 AM
To: cmdist at ccrma.Stanford.EDU <cmdist at ccrma.Stanford.EDU>
Subject: Cmdist Digest, Vol 169, Issue 9

Send Cmdist mailing list submissions to
        cmdist at ccrma.stanford.edu

To subscribe or unsubscribe via the World Wide Web, visit
or, via email, send a message with subject or body 'help' to
        cmdist-request at ccrma.stanford.edu

You can reach the person managing the list at
        cmdist-owner at ccrma.stanford.edu

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Cmdist digest..."

Today's Topics:

   1. Re: make-bandpass xcoeffs (bil at ccrma.Stanford.EDU)


Message: 1
Date: Wed, 29 Jun 2022 12:04:42 -0700
From: bil at ccrma.Stanford.EDU
To: James Hearon <j_hearon at hotmail.com>
Cc: "cmdist at ccrma.Stanford.EDU" <cmdist at ccrma.Stanford.EDU>
Subject: Re: [CM] make-bandpass xcoeffs
Message-ID: <4bc1a174e5c876e81b11ac36a08865dd at ccrma.stanford.edu>
Content-Type: text/plain; charset=US-ASCII; format=flowed

make-bandpass is a wrapper around make-fir-filter, returning
an fir-filter generator, so mus-xcoeffs does work with it;
there's an example in snd-test.scm around line 7706.
make-bandpass is not itself a generator; it returns one.
If you look at the code in dsp.scm you'll see
(define bandpass fir-filter) -- this says the
bandpass generator is an fir-filter.  In the
first case, I think you're setting a vector to the
output of the bandpass generator, and in the second
it looks like you've copied the make-bandpass code
to set the vector, so you're setting the vector to
two different things.


Cmdist mailing list
Cmdist at ccrma.stanford.edu

End of Cmdist Digest, Vol 169, Issue 9
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cm-mail.stanford.edu/pipermail/cmdist/attachments/20220701/b2e15fe8/attachment.html>

More information about the Cmdist mailing list