Hey all,
I want to make a thing and I don’t know how 🤪 I’ve ( poorly) drawn an example of what I’m trying to do. I want to be able to pass bangs ( or numbers) from inlet to outlet and have the outlets rotate on receiving a bang .
-
Rotational shift input / output
-
I would use
[demultiplex]
from zexy for that. Have a counter. When you get a message in an inlet, add the counter to the inlet number (starting at 0) modulo the total number of inlets, and send that number to the right inlet of[demultiplex]
before sending the message to it (you'd probably use[t a b]
). When you want to rotate just increment the counter. -
Is there a way to get anything close in Vanilla ? I’m trying to just use Vanilla while I’m still learning.
-
the way to do it with vanilla would be to use
[list prepend]
and[route]
instead of the[demultiplex]
-
ok, figuring this out is the next level for me but I'm going to keep reading the help files and experimenting.
-
@WEIRD1 As you want floats and bangs (and maybe symbols and lists one day?) to pass through unchanged...... maybe build your "router" with a bunch of [spigot] objects ..... 3 per inlet and each connected to one of the 3 outlets.
Then a counter that rotates 1, 2, 3 as it is banged (by your bang [inlet] ) and its output sent to the control inlets of the spigots via [== 1] [== 2] [== 3] for the first inlet and [== 3] [== 1] [== 2] for the second..... etc..... I think.......
When the counter output is 2....... for example.... [== 2] will output 1 and open the spigot...... whereas [== 1] and [== 3] will output 0 and close their spigots.
You will have built a rotating multi-gate in vanilla........
All vanilla.....Started for you but untested..... so please check it...... bof.zip
(( Just noticed that you should also change the initial [spigot] arguments for each inlet so that they route correctly on creation.))When you have finished it save it and use it in your patches as an abstraction (you will have created your first)..... by "putting" [bof] in a patch. You should probably save it with a name that makes more sense though.
You could even make a [bof-help] file so that it will be understood later.BUT!!! change the send/receive names first..... to [s $0-control] and [s $0-out1]....etc.... or when you use the abstraction more than once the instances will be receiving each others messages....... https://forum.pdpatchrepo.info/topic/9774/pure-data-noob/4
A lot to absorb.... but worth it....!
David.
-
I generally use [send] and [receive] anytime i don't want to worry about [route] stripping selectors, it tends to be neater than [spigot] but [spigot] tends to be more efficient. [pack] and [unpack] are handy for making shift registers. [route] is generally the best option for routing things if you do not need to worry about types.
routeroundaround.pd
Edit: I screwed up the order of the symbol names, first time through and they will be shifted by one. Oh well. -
@oid [pack] [unpack] is a great idea....
David.