IIR using buffir~

Feb 20, 2008 at 6:39pm

IIR using buffir~

can anyone help me with implementing an IIR filter, is it possible to use the buffir~ object, i’ve tried but seem to get no output. regards

#35905
Feb 20, 2008 at 7:32pm

IIR filters need feedback (at usually less than the MaxMSP signal
vector size). Also, most standard MSP objects will not let you do
feedback directly anyway. The multitap delay objects in MSP allow
feedback, but the minimum delay length, imposed by the signal vector
size, is too long for most filtering applications. From what I’ve
gathered on this list in recent discussions, cooking one up in Java
is probably the way to go (That’s one of my summer projects, by the
way….when summer arrives.) unless you are good at coding externals
in C++ (which is not me….). Personally, I’d love to have a set of
comb-type objects with accessible feedback loops (for filtering,
etc.) as MSP standard objects. Meanwhile, have a look at [comb~] and
[teeth~], among others, to see if they get you where you want to go.

There was some discussion on this general topic a couple months ago
in the forum – have a look.

On Feb 20, 2008, at 6:39 PM, ben Gilman wrote:

>
> can anyone help me with implementing an IIR filter, is it possible
> to use the buffir~ object, i’ve tried but seem to get no output.
> regards

—-
Steven M. Miller
Professor, Contemporary Music Program
College of Santa Fe

Home < http://pubweb.csf.edu/~smill>
SFIFEM <
http://sfifem.csf.edu>
Atrium Sound Space <
http://atrium.csf.edu>
OVOS <
http://pubweb.csf.edu/~smill/ovos.html>
CMP <
http://www.csf.edu/academics/contemporary_music/>

#122999
Feb 20, 2008 at 9:05pm

thanks for your response.there is apparently the possibility of using a P4P5 filter in-place of the IIR but im unsure as to how to construct one in Max/Msp.

#123000
Feb 20, 2008 at 9:27pm

Hi Ben,

I’m unfamiliar with the ‘P4P5 filter’ reference. Perhaps you can
provide some contextual information about the project you’re working
on and the intended outcome/application? That might give enough info
to help send you in the right direction.

Best,

Steven

p.s. – a brief quote from the email/post to which you are replying
(i.e., I assume you are replying to my previous response) is helpful,
particularly to those of us using the email list rather than the
online forum. See the recent post on discussion threads for more
‘user-friendliness’ tips.

On Feb 20, 2008, at 9:05 PM, ben Gilman wrote:

>
> thanks for your response.there is apparently the possibility of
> using a P4P5 filter in-place of the IIR but im unsure as to how to
> construct one in Max/Msp.

—-
Steven M. Miller
Professor, Contemporary Music Program
College of Santa Fe

Home < http://pubweb.csf.edu/~smill>
SFIFEM <
http://sfifem.csf.edu>
Atrium Sound Space <
http://atrium.csf.edu>
OVOS <
http://pubweb.csf.edu/~smill/ovos.html>
CMP <
http://www.csf.edu/academics/contemporary_music/>

#123001
Feb 21, 2008 at 1:26pm

Quote: smill wrote on Wed, 20 February 2008 21:27
—————————————————-
> Hi Ben,
> I’m unfamiliar with the ‘P4P5 filter’ reference. Perhaps you can > provide some contextual information about the project you’re
> working on and the intended outcome/application? That might give > enough info to help send you in the right direction.
> Best,
> Steven

A quote makes sense sorry about that, is that a sure fire way to spot a newbie or does the fact it say junior member at the top of every post give it away.

Im attempting to impliment an active noise cancellation system using Max/Msp. The IIR or P4P5 filter is the control filter for the system, i’ve implemented a FXLMS (Filterd-x least means square) algorithm and that gives me 256 filter weights coefficients for the control filter. Ive attached an image describing the P4P5 filter, im having a hard time picturing how the data flows (at sample level) through the filter.
regards,
ben

#123002
Feb 24, 2008 at 10:21am

Does anyone have any thought about constructing the stated P4P5 filter, i don’t thoroughly understand the tapped delay lines. any pointers no matter how small would be greatly appreciated.
regards ben

#123003
Feb 24, 2008 at 5:29pm

Do you have a web reference for the design/topology of the P4P5
filter? If so, I’d be happy to have a look and see if I can help
explain it. I can’t find any info on it doing a simple google search.

On Feb 24, 2008, at 10:21 AM, ben Gilman wrote:

>
> Does anyone have any thought about constructing the stated P4P5
> filter, i don’t thoroughly understand the tapped delay lines. any
> pointers no matter how small would be greatly appreciated.
> regards ben
>

—-
Steven M. Miller
Professor, Contemporary Music Program
College of Santa Fe

Home < http://pubweb.csf.edu/~smill>
SFIFEM <
http://sfifem.csf.edu>
Atrium Sound Space <
http://atrium.csf.edu>
OVOS <
http://pubweb.csf.edu/~smill/ovos.html>
CMP <
http://www.csf.edu/academics/contemporary_music/>

#123004
Feb 24, 2008 at 9:07pm

Quote: smill wrote on Sun, 24 February 2008 17:29
—————————————————-
> Do you have a web reference for the design/topology of the P4P5
> filter? If so, I’d be happy to have a look and see if I can help
> explain it. I can’t find any info on it doing a simple google search.

Have you viewed the diagram i attached to one of my previous posts i could email it you if thats any help. Its actually a Non Linear Polynomial (P4P5) Filter.
regards ben

#123005
Feb 24, 2008 at 9:21pm

I didn’t see the attachment – I’m on the email list not the forum, so
it may not have been passed along. Can you email the diagram to me
directly?

On Feb 24, 2008, at 9:07 PM, ben Gilman wrote:
>
> Have you viewed the diagram i attached to one of my previous posts
> i could email it you if thats any help. Its actually a Non Linear
> Polynomial (P4P5) Filter.
> regards ben

—-
Steven M. Miller
Professor, Contemporary Music Program
College of Santa Fe

Home < http://pubweb.csf.edu/~smill>
SFIFEM <
http://sfifem.csf.edu>
Atrium Sound Space <
http://atrium.csf.edu>
OVOS <
http://pubweb.csf.edu/~smill/ovos.html>
CMP <
http://www.csf.edu/academics/contemporary_music/>

#123006
Feb 24, 2008 at 10:09pm

#123007
Feb 25, 2008 at 12:56am

I’m no expert on filters, but here’s my take on the illustration.

From what I can tell from the illustration and info from online,
this is intended to be a filter for creating a control signal for
noise control systems, not an audio filter, per se. As such, it may
not give you anything very useable as a straight audio filter. In any
case, this is just a particular variant of an FIR filter (i.e. no
feedback).

In a nutshell, there are two multi-tap networks, each with their own
set of summing weights (unspecified, as far as I could find). The
number of taps in each network is unspecified. The first network is
fed the input signal raised to the 4th power, the second is fed the
input signal raised to the 5th power. The summed outputs of each of
the two multi-tap networks are then summed together to form the
output (control) signal. I would assume that the weights are chosen
to sum to unity (1).

On Feb 24, 2008, at 9:07 PM, ben Gilman wrote:

>
> Have you viewed the diagram i attached to one of my previous posts
> i could email it you if thats any help. Its actually a Non Linear
> Polynomial (P4P5) Filter.
> regards ben

—-
Steven M. Miller
Professor, Contemporary Music Program
College of Santa Fe

Home < http://pubweb.csf.edu/~smill>
SFIFEM <
http://sfifem.csf.edu>
Atrium Sound Space <
http://atrium.csf.edu>
OVOS <
http://pubweb.csf.edu/~smill/ovos.html>
CMP <
http://www.csf.edu/academics/contemporary_music/>

#123008
Feb 25, 2008 at 9:17am

Quote: smill wrote on Mon, 25 February 2008 00:56
—————————————————-
> I’m no expert on filters, but here’s my take on the illustration.

It is indeed a control filter for a noise cancellation system, im not sure if im understanding the multitap delay in the correct manner. is it a delay as in the next sample within the signal. does the following patch come close to describing its function.

regards ben

#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P newex 90 59 61 196617 buffer~ ref;
#P newex 9 5 48 196617 loadbang;
#P message 9 33 85 196617 sizeinsamps 256;
#P newex 9 59 79 196617 buffer~ CFw(k);
#P newex 262 103 36 196617 edge~;
#P newex 262 78 49 196617 ==~ 255;
#P button 240 36 15 0;
#P message 267 34 29 196617 stop;
#P newex 250 56 70 196617 count~ 0 256;
#P newex 195 328 27 196617 +~;
#P newex 311 292 27 196617 +~;
#P newex 104 292 27 196617 +~;
#P newex 407 167 57 196617 index~ ref;
#P newex 200 167 57 196617 index~ ref;
#P newex 104 231 107 196617 buffir~ CFw(k) 0 255;
#P newex 104 186 38 196617 sig~ 4;
#P newex 104 208 106 196617 pow~;
#P comment 211 194 51 196617 reference;
#P newex 311 228 107 196617 buffir~ CFw(k) 0 255;
#P newex 311 183 38 196617 sig~ 5;
#P newex 311 205 106 196617 pow~;
#P comment 419 190 51 196617 reference;
#P comment 224 230 73 196617 control filter;
#P comment 193 372 41 196617 output;
#P window linecount 8;
#P comment 10 81 100 196617 buffer~ CFw(k) is where 256 filter weights are stored these are calculated using a FXLMS algorithm that is not included in this patch.;
#P connect 22 0 21 0;
#P connect 22 0 24 0;
#P fasten 16 0 11 0 255 144 205 144;
#P connect 16 0 19 0;
#P fasten 16 0 12 0 255 144 412 144;
#P connect 23 0 22 0;
#P connect 17 0 16 0;
#P connect 18 0 16 0;
#P connect 19 0 20 0;
#P fasten 20 1 17 0 293 139 322 139 322 29 272 29;
#P fasten 14 0 15 1 316 316 217 316;
#P fasten 13 0 15 0 109 316 200 316;
#P connect 10 0 13 0;
#P connect 9 0 8 0;
#P connect 8 0 10 0;
#P connect 11 0 8 1;
#P connect 6 0 14 0;
#P connect 5 0 4 0;
#P connect 4 0 6 0;
#P connect 12 0 4 1;
#P window clipboard copycount 25;

#123009
Feb 25, 2008 at 5:03pm

Hi Ben,

I’ve never used the [buffir~] object, but based on my understanding
of the MSP manual page, it does not behave like the multi-tap
networks in the P4P5 filter diagram. (Someone with more experience
with the [buffir~] object, feel free to chime in!) The [buffir~]
object performs a convolution of the input signal with each sample of
the buffer used as a coefficient.

A multi-tap network simply sums a number of individual delays (each
tap is its own delay in parallel with the others) each multiplied by
the weighting coefficient.

A way to do this in MSP would be to use a number of [delay~] objects
(no feedback needed) set to different delay times, each multiplied by
the corresponding weight, then summed together.

Hope this helps. I don’t have the free time right now to put together
a patch to illustrate, but hopefully this explanation is clear enough.

Best,

Steven

On Feb 25, 2008, at 9:17 AM, ben Gilman wrote:

>
> Quote: smill wrote on Mon, 25 February 2008 00:56
> —————————————————-
>> I’m no expert on filters, but here’s my take on the illustration.
>
>
> It is indeed a control filter for a noise cancellation system, im
> not sure if im understanding the multitap delay in the correct
> manner. is it a delay as in the next sample within the signal. does
> the following patch come close to describing its function.
>
> regards ben

—-
Steven M. Miller
Professor, Contemporary Music Program
College of Santa Fe

Home < http://pubweb.csf.edu/~smill>
SFIFEM <
http://sfifem.csf.edu>
Atrium Sound Space <
http://atrium.csf.edu>
OVOS <
http://pubweb.csf.edu/~smill/ovos.html>
CMP <
http://www.csf.edu/academics/contemporary_music/>

#123010
Feb 25, 2008 at 11:23pm

i suspected the [buffir~] object wouldn’t be appropriate. My only issue might be the fact that i need a few hundred taps how cpu intensive will that be? thanks for your description.
regards
ben

Quote: smill wrote on Mon, 25 February 2008 17:03
—————————————————-
> Hi Ben,
>
> I’ve never used the [buffir~] object, but based on my understanding
> of the MSP manual page, it does not behave like the multi-tap
> networks in the P4P5 filter diagram. (Someone with more experience
> with the [buffir~] object, feel free to chime in!) The [buffir~]
> object performs a convolution of the input signal with each sample of
> the buffer used as a coefficient.
>
> A multi-tap network simply sums a number of individual delays (each
> tap is its own delay in parallel with the others) each multiplied by
> the weighting coefficient.
>
> A way to do this in MSP would be to use a number of [delay~] objects
> (no feedback needed) set to different delay times, each multiplied by
> the corresponding weight, then summed together.
>
> Hope this helps. I don’t have the free time right now to put together
> a patch to illustrate, but hopefully this explanation is clear enough.
>
> Best,
>
> Steven

#123011
Feb 26, 2008 at 5:12am

I suspect that simple delays with no feedback should be relatively
efficient, but the only way to know for sure is to try… ;)

On Feb 25, 2008, at 11:23 PM, ben Gilman wrote:

>
> i suspected the [buffir~] object wouldn’t be appropriate. My only
> issue might be the fact that i need a few hundred taps how cpu
> intensive will that be? thanks for your description.
> regards
> ben

—-
Steven M. Miller
Professor, Contemporary Music Program
College of Santa Fe

Home < http://pubweb.csf.edu/~smill>
SFIFEM <
http://sfifem.csf.edu>
Atrium Sound Space <
http://atrium.csf.edu>
OVOS <
http://pubweb.csf.edu/~smill/ovos.html>
CMP <
http://www.csf.edu/academics/contemporary_music/>

#123012
Feb 26, 2008 at 10:54pm

and try i will.i may look into using poly~ an object i haven’t used but on first inspection it seems it may be possible to use for the quantity of multitaps i need.
regards ben

Quote: smill wrote on Tue, 26 February 2008 05:12
—————————————————-
> I suspect that simple delays with no feedback should be relatively
> efficient, but the only way to know for sure is to try… ;)

#123013
Feb 26, 2008 at 11:31pm

On Feb 26, 2008, at 2:54 PM, ben Gilman wrote:

>
> and try i will.i may look into using poly~ an object i haven’t used
> but on first inspection it seems it may be possible to use for the
> quantity of multitaps i need.

I haven’t been following this discussion, but I do have a couple
examples using poly~, and one application that uses it.

The simple examples can be found here: http://www.xfade.com/max/examples
StupidSynth
PollyWannaAllocate

The application is called TheMill, and it’s a granular playback
thingy, which can be found here:

http://www.xfade.com/max/

-C

Chris Muir
cbm@well.com

#123014
Feb 27, 2008 at 12:11am

> Hi Ben,
>
> I’ve never used the [buffir~] object, but based on my understanding
> of the MSP manual page, it does not behave like the multi-tap
> networks in the P4P5 filter diagram. (Someone with more experience
> with the [buffir~] object, feel free to chime in!) The [buffir~]
> object performs a convolution of the input signal with each sample
> of the buffer used as a coefficient.

A time-domain convolution is actually combination of delay and gain.
(but with delay specified in samples, and all samples within the
window potentially represented) Buffir~ does a time-domain
convolution, so it is the same thing as a bunch of delay~ objects,
with the added benefit that you get gain control thrown in for free.

> A multi-tap network simply sums a number of individual delays (each
> tap is its own delay in parallel with the others) each multiplied by
> the weighting coefficient.

This is the same thing that buffir~ does, except with buffir~ every
tap is one sample away from the next tap.

That all said, buffir~ is designed for very short IRs (256 samples or
less). Because it’s so short, you’re only going to hear its effects
in the frequency domain, rather than the time domain.

If you needed to sum the last 256 or less samples of your input, you
could certainly do it with buffir~. On the other hand, if you wanted
to build a pretty cool comb-filter without feedback, tapin~/tapout~
(with lots of integer multiple args) would do the job nicely.

Peter McCulloch

#123015
Mar 2, 2008 at 7:04pm

> A time-domain convolution is actually combination of delay and gain.
> (but with delay specified in samples, and all samples within the
> window potentially represented) Buffir~ does a time-domain
> convolution, so it is the same thing as a bunch of delay~ objects,
> with the added benefit that you get gain control thrown in for free.

excellent i suspected the buffir~ object performed as a multitap delay.does that mean that this patch describes the function of the filter at the following link.

http://www.cycling74.com/forums/index.php?t=getfile&id=1231&rid=0&S=32e9fce9c159425eddbece03c5942629

#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P newex 90 59 61 196617 buffer~ ref;
#P newex 9 5 48 196617 loadbang;
#P message 9 33 85 196617 sizeinsamps 256;
#P newex 9 59 79 196617 buffer~ CFw(k);
#P newex 262 103 36 196617 edge~;
#P newex 262 78 49 196617 ==~ 255;
#P button 240 36 15 0;
#P message 267 34 29 196617 stop;
#P newex 250 56 70 196617 count~ 0 256;
#P newex 195 328 27 196617 +~;
#P newex 311 292 27 196617 +~;
#P newex 104 292 27 196617 +~;
#P newex 407 167 57 196617 index~ ref;
#P newex 200 167 57 196617 index~ ref;
#P newex 104 231 107 196617 buffir~ CFw(k) 0 255;
#P newex 104 186 38 196617 sig~ 4;
#P newex 104 208 106 196617 pow~;
#P comment 211 194 51 196617 reference;
#P newex 311 228 107 196617 buffir~ CFw(k) 0 255;
#P newex 311 183 38 196617 sig~ 5;
#P newex 311 205 106 196617 pow~;
#P comment 419 190 51 196617 reference;
#P comment 224 230 73 196617 control filter;
#P comment 193 372 41 196617 output;
#P window linecount 8;
#P comment 10 81 100 196617 buffer~ CFw(k) is where 256 filter weights are stored these are calculated using a FXLMS algorithm that is not included in this patch.;
#P connect 22 0 21 0;
#P connect 22 0 24 0;
#P fasten 16 0 11 0 255 144 205 144;
#P connect 16 0 19 0;
#P fasten 16 0 12 0 255 144 412 144;
#P connect 23 0 22 0;
#P connect 17 0 16 0;
#P connect 18 0 16 0;
#P connect 19 0 20 0;
#P fasten 20 1 17 0 293 139 322 139 322 29 272 29;
#P fasten 14 0 15 1 316 316 217 316;
#P fasten 13 0 15 0 109 316 200 316;
#P connect 10 0 13 0;
#P connect 9 0 8 0;
#P connect 8 0 10 0;
#P connect 11 0 8 1;
#P connect 6 0 14 0;
#P connect 5 0 4 0;
#P connect 4 0 6 0;
#P connect 12 0 4 1;
#P window clipboard copycount 25;

> That all said, buffir~ is designed for very short IRs (256 samples or
> less). Because it’s so short, you’re only going to hear its effects
> in the frequency domain, rather than the time domain.

All i need is 256 taps with 1 sample delays between, the effects of the filter do not need to be heard as it’s a control filter.

regards ben

#123016
Mar 2, 2008 at 9:50pm

Hi Ben,

Just an FYI – A primary difference between a true multitap delay and
convolution with [buffir~] is that each stage in convolution is a
single-sample delay beyond the previous stage whereas with a multitap
delay, each individual delay time is independently variable.

It was unclear from the diagram and web-based info I could find how
many taps were specified and what the delay times were intended to
be. In retrospect, it could just as well have been a convolution with
an unspecified number of stages.

Best,

Steven

On Mar 2, 2008, at 7:04 PM, ben Gilman wrote:

>
>
>> A time-domain convolution is actually combination of delay and gain.
>> (but with delay specified in samples, and all samples within the
>> window potentially represented) Buffir~ does a time-domain
>> convolution, so it is the same thing as a bunch of delay~ objects,
>> with the added benefit that you get gain control thrown in for free.
>
> excellent i suspected the buffir~ object performed as a multitap
> delay.does that mean that this patch describes the function of the
> filter at the following link.

—-
Steven M. Miller
Professor, Contemporary Music Program
College of Santa Fe

Home < http://pubweb.csf.edu/~smill>
SFIFEM <
http://sfifem.csf.edu>
Atrium Sound Space <
http://atrium.csf.edu>
OVOS <
http://pubweb.csf.edu/~smill/ovos.html>
CMP <
http://www.csf.edu/academics/contemporary_music/>

#123017

You must be logged in to reply to this topic.