abstraction for repeating an operation

Aug 14, 2010 at 4:46pm

abstraction for repeating an operation

i need to make an abstraction which can help me to repeat a certain process, for example on numbers,
for a given amount.

as you can see, i dont even know the right term for it.

let me give you an example instead:

there is a processs, [+ 5] which is applied to numbers. now i want to route the output of the
number back into the input in order to repeat [+ 5] fpr 17 times.

you might say that is easy with [counter] and [gate] but i cant find a simple and effective solution.

even when i start involving [grab] and pvars i see buffer underruns :D

does anyone have something like this already?

max 4.x or jpg please!

-110

#51777
Aug 14, 2010 at 5:07pm

How about a for loop in javascript?

#185792
Aug 14, 2010 at 5:10pm

Hello Roman,

have you tried with [jit.matrix] ?

HTH.

[attachment=138850,967]

Attachments:
  1. test.png
#185793
Aug 14, 2010 at 8:49pm

Counter and Uzi are pretty much made for this (do something N times.) Here's an example:

– Pasted Max Patch, click to expand. –

[attachment=138860,968]

Attachments:
  1. Iterate.png
#185794
Aug 16, 2010 at 10:34am

aha, “iteration”, right, i should have known that word.

thanks for your ideas.

js is not an option for max4 and might be bit slow for timecritical
applications. but “loop” rings a bell.

indeed counter and uzi seem straightforward, but if you try
to redo the above patcher to work with [+ ] as well as [zl sort] and
[spintf] you will understand my problem with this method. :)

jit.matrxi or table are also not wrong ideas, yet limited.

i might stick to counter as there seem to be no other way.

#185795
Aug 16, 2010 at 12:55pm

Hello Roman,

i never used them, but “OO objects” maybe ?

#185796
Aug 16, 2010 at 5:29pm

The above patch is using [+], but I have no idea how you would like to use [zl sort] or [sprintf]. Perhaps if you posted your patch, we could see where you’re going wrong.

#185797
Aug 23, 2010 at 5:57am

I would use scripting and Chris’ method with counter, but with an deferlowed iteration (not as fast as uzi, but works). Then do a “script replace” on the operator (+) object to exchange it on the fly with another operator…
You could even script complex formulas by exchanging the + object with an expr object…

– Pasted Max Patch, click to expand. –
Attachments:
  1. Iteration.png
#185798

You must be logged in to reply to this topic.