Re: [CM] make-bandpass

2022-07-01 Thread bil

If the bandpass generator is getting no input, it returns
0.0.  Otherwise it returns the output of the bandpass
filter (normally audio samples).  mus-xcoeffs is an
array of filter coefficients -- these are convolved
with the input to produce the output, so


;(float-vector-set! v l (bandpass b l)) ;what is output here?


The output of (bandpass b 0) then (bandpass b 1).


(float-vector-set! v l ((mus-xcoeffs b) l)) ;filter magnitudes


The first and second filter coefficients.


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


this adds the output of two bandpass generators.  It is not
the same as adding the two generator's filter coefficients.

Julius Smith has written a very good introduction to filters,
available for free online I think.

___
Cmdist mailing list
Cmdist@ccrma.stanford.edu
https://cm-mail.stanford.edu/mailman/listinfo/cmdist


[CM] make-bandpass

2022-07-01 Thread James Hearon
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.

Regards,
Jim

From: cmdist-boun...@ccrma.stanford.edu  on 
behalf of cmdist-requ...@ccrma.stanford.edu 
Sent: Thursday, June 30, 2022 9:00 AM
To: cmdist@ccrma.Stanford.EDU 
Subject: Cmdist Digest, Vol 169, Issue 9

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

To subscribe or unsubscribe via the World Wide Web, visit
https://cm-mail.stanford.edu/mailman/listinfo/cmdist
or, via email, send a message with subject or body 'help' to
cmdist-requ...@ccrma.stanford.edu

You can reach the person managing the list at
cmdist-ow...@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 (b...@ccrma.stanford.edu)


--

Message: 1
Date: Wed, 29 Jun 2022 12:04:42 -0700
From: b...@ccrma.stanford.edu
To: James Hearon 
Cc: "cmdist@ccrma.Stanford.EDU" 
Subject: Re: [CM] make-bandpass xcoeffs
Message-ID: <4bc1a174e5c876e81b11ac36a0886...@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@ccrma.stanford.edu
https://cm-mail.stanford.edu/mailman/listinfo/cmdist


End of Cmdist Digest, Vol 169, Issue 9
**
___
Cmdist mailing list
Cmdist@ccrma.stanford.edu
https://cm-mail.stanford.edu/mailman/listinfo/cmdist