Is there an object, that bangs a specified outlet when given a number?

Jul 10, 2009 at 12:42pm

Is there an object, that bangs a specified outlet when given a number?

I am looking for an object with a single inlet and multiple outlets, than when given a number as input would send a bang out the corresponding outlet.

This is for controlling a step sequencer.

As far as I can tell, people who have done this mostly use a router object (router 1 2 3 4) and then send it a # followed by a bang or else they send lists of 0 0 0 1 0 into an unpack object.

Seems like a simple thing. Is there an object like what I describe?

#44683
Jul 10, 2009 at 12:57pm

The [select] object will do this if you instantiate it with the amount of outlets you need. For example: [sel 1 2 3 4 5 6 7 8].

lh

#160807
Jul 10, 2009 at 1:37pm

Aha! Peter Elsea’s Banger object seems to do this exactly. Kind of surprising that it doesn’t exist in Max directly.

#160808
Jul 10, 2009 at 2:05pm

It kind of does exist in [spray].

– Pasted Max Patch, click to expand. –
#160809
Jul 10, 2009 at 2:06pm

actually nevermind, [select] does exactly that

#160810
Jul 10, 2009 at 2:09pm

Yeah, I saw select used that way, but you have to fill in the list values (eg. 0 1 2 3 4) to get the outlets, whereas Elsea’s banger object you just give it the number of outlets (eg. (banger 5)) and then it will spit out a bang when you feed it an integer.

#160811
Jul 12, 2009 at 8:30am

Here’s an example using [gate], which lets you specify the number of outlets. The caveat is the triggering order: first open the outlet you want, then send the bang through.

I guarantee this will be (at least a little bit) fun to play with

– Pasted Max Patch, click to expand. –
#160812
Jul 12, 2009 at 1:38pm

That’s smart! I think (trigger b i) followed by a (gate) is exactly what I’ve been looking for.

Also, in your patch, you can replace all the set + number boxes by sticking a (switch) object right below the number boxes.

Then the trigger object that opens the gate can also open the switch, before sending the bang, and then sends a 0 to close the switch. See below.

– Pasted Max Patch, click to expand. –
#160813
Jul 12, 2009 at 2:00pm

Another method would be to use [pak] and [zl lookup]. Then you can deal with your sequenced pattern as a list and use [vexpr] and [zl rot], [zl scramble] etc to modify them as well as storing the individual values with [preset] or the [pattr] system.

lh

– Pasted Max Patch, click to expand. –
#160814
Jul 12, 2009 at 2:04pm

Thanks! Every post on this thread has been inspiring and useful.

What is a good way to get the pattern back into the number boxes after going through the zl scramble operation?

#160815
Jul 12, 2009 at 4:24pm

Looking at it again, it’s even easier to use [i ] at the end, before banging it into a note. This eliminates the need for the set or switch and is maybe faster, not sure.

For the [zl scramble] or [zl rot] getting back into the number boxes, that depends on how you set things up. I usually have some sort of cascade where the last list is what’s utilized, but is read-only or hidden. Otherwise you do need some sort of set operation, which you’d think would be straightforward, but if you “re-set $1″ for elements of a list that you’ve just rotated, you’ll get some bizarre offseting results.

Try the multisliders in the ZL subpatch to see what I mean… if you set the rotated values back into the list, it’s not what you might expect, but on the other hand can be used to easily generate cool repeating patterns, based on the rotate amount and the number of sliders.

I’m sure there are other solutions for the “setting values back into themselves”, maybe with [v] or [pvar].

– Pasted Max Patch, click to expand. –
#160816

You must be logged in to reply to this topic.