How to: bang a message to repeat itself a specified number of times

Apr 21, 2012 at 8:50pm

How to: bang a message to repeat itself a specified number of times

I would like to be able to type a sequence of numbers into a [textedit], then upon banging the object, send a specified number of copies of the [textedit] text to a message box. For example, I have a 32 bar multislider, and want to be able to type four numbers into a box – which will then repeat itself across the 32 steps upon bang. Attached is an example of the [multislider] in the state I would like it to be in upon typing the four number phrase into a box.

– Pasted Max Patch, click to expand. –
#63133
Apr 21, 2012 at 10:20pm

Do you need to specify the number of repeats at run time, or just hard code them?

If the latter then a combination of [t l l l ...] and an appropriately sized [pack ] will see you right.

If the former, then some combination of [uzi], [zl reg] and [zl group]?

#227821
Apr 21, 2012 at 10:39pm

I am not really familiar with that language, however, I can explain through an example

I require [1 2 3 4 1 2 3 4] to be outputted in a single message for an input of [1 2 3 4] and a specified repetition of two – rather than the message [1 2 3 4] being sent in two separate instances.

Would this be requiring a repetition of run time or hard code?

#227822
Apr 21, 2012 at 10:51pm

I understand now. I am after a specified number of repeats at run time. I will use the packing system.

#227823
Apr 22, 2012 at 10:11pm

[zl group] is your best bet, I think. be sure to specify a large list length if it will be using long lists, the default is 256 I think. so,

[zl 2048 group]

will let you store up to 2048 list members in your repeating sequence. [uzi] will do the repetition for you…very quickly.

#227824
Apr 23, 2012 at 2:06pm

[zl len] -> length of the list

(specified number of repeats) * (length of the list) = argument for [zl group]

#227825

You must be logged in to reply to this topic.