MUFF WIGGLER Forum Index
 FAQ & Terms of UseFAQ & Terms Of Use   Wiggler RadioMW Radio   Muff Wiggler TwitterTwitter   Support the site @ PatreonPatreon 
 SearchSearch   RegisterSign up   Log inLog in 
WIGGLING 'LITE' IN GUEST MODE

Max/Pure Data 'Urn' object - modular patch equivalent?
MUFF WIGGLER Forum Index -> Modular Synth General Discussion  
Author Max/Pure Data 'Urn' object - modular patch equivalent?
Navs
There’s an object in max/msp and Pure Data called 'Urn'. It "generates random numbers without duplicates":

https://docs.cycling74.com/max5/refpages/max-ref/urn.html

As the imagery suggests, once a number has been taken from the urn, it’s out of the running until the urn is refilled. Another image might be selecting cards from a pack and discarding each one after selection.

I'm new to PD, so I don't know if there's a way of 'unpacking' an object to see how it works. Any ideas on how one might patch this?

Bonus points if there's a way of determining which notes are randomly selected, rather than just how many numbers.
authorless
I can't think of a way the make it only do random values that haven't been used yet. Interesting problem though.

For getting the specific notes you want you could use a sequencer that has voltage control over step addressing. Doepfer A-154 plus A-155 would do it.
MarcelP
I am guessing the Schoenberg Tone Row module would do it - once it is invented... Until that arrives I have no idea how to patch it! It is the “removal from the urn”, or non-repeat, that is problematic. It is a mode that would be nice on Rene - a kind of randomised snake...
Navs
Thanks for your thoughts, guys.

authorless, yes, I had thought about a voltage addressable sequencer to set the notes. But it would still be prone to repeats if driven by a random CV.

MarcelP, yes! I was thinking if this would be musically useful and I think you may have found an application hihi

I can think of a way to avoid immediate repeats with an analogue shift register or delayed S&H and a window comparator (if new=old, don't play it) but not how to delve further back in history hmmm.....
listentoaheartbeat
I think this is done by taking an array of numbers and shuffling it to create the random sequence without duplicates. So I assume it is a deterministic process: Once the number of possible values is set, urn just goes through the shuffled array until it has reached its end.
Navs
eek! Eureka! Thanks listentoaheartbeat!

I was thinking of selecting the numbers at random but I now see this could be done by selecting an array at random. The arrays would number the total number of possible combinations and the arrays would be addressed by a VA switch.

I'll have to try this hyper Of course, I can now see that one might get a repeated array ... I wonder if that also happens with Urn ...
Navs
Pd's Urn does repeat, as you can see in the print out on the left:



So, I patched the following in the G2:



The way it works is that a new array/sequencer is selected at random every 4 clock pulses. The three notes are played, the fourth note on the top sequencer fires a gate to mute the sequence ... just to audibly mark the end of each run.

It's ok to prove it works, but there's got to be a more elegant or efficient way of filling the tables, especially if one wants to use more than three variables lol ... use one table and shuffle the contents?
Pelsea
Actually, the urn code is very simple, since it is limited to ints in the range specified specified by arg. There is an array the size of arg that initially contains all zeros. When a bang comes in, a random array pointer is generated-- if that points to a 0, the pointer is output and the 0 changed to 1. If the random pointer finds a 1, a new pointer is generated until a 0 is found. There's a counter to keep track of successes-- when all of the array slots have been used, further bangs are just passed to the right outlet.

The chances of getting the same series twice are factorial arg.

If I ever build another sequencer, I'll include this in the µcontroller code. Since the value generated has to point to something, it may as well point to a knob.
ym2612
MarcelP wrote:
I am guessing the Schoenberg Tone Row module would do it - once it is invented... Until that arrives I have no idea how to patch it! It is the “removal from the urn”, or non-repeat, that is problematic. It is a mode that would be nice on Rene - a kind of randomised snake...


I would pay some decent amount of money for such a module, one with several outputs, inversions, reverses, random seeding, etc. Maybe I should build it. Or write it for O_C.
Navs
Thanks for the explanation, Pelsea.

It's still a bit over my head - is there a way to patch this with modules/ what would the equivalents be?
MarcelP
ym2612 wrote:
MarcelP wrote:
I am guessing the Schoenberg Tone Row module would do it - once it is invented... Until that arrives I have no idea how to patch it! It is the “removal from the urn”, or non-repeat, that is problematic. It is a mode that would be nice on Rene - a kind of randomised snake...


I would pay some decent amount of money for such a module, one with several outputs, inversions, reverses, random seeding, etc. Maybe I should build it. Or write it for O_C.


I would also pay good money for this! Would prompt me to get an O_C if it (and variants as mentioned) were available on that.
ersatzplanet
Navs wrote:
Any ideas on how one might patch this?


The easiest way is to get a module that runs PD programs like the Qu-Bit Nebulae and just run it on that.
listentoaheartbeat
Navs wrote:
It's still a bit over my head - is there a way to patch this with modules/ what would the equivalents be?


I don’t see how this can be done efficiently without involving a MCU running a program (that either populates arrays of non-repeating random numbers or filters out repetitions based on memory). But I will give it some more thought, too.. smile
Navs
ersatzplanet wrote:
Navs wrote:
Any ideas on how one might patch this?


The easiest way is to get a module that runs PD programs like the Qu-Bit Nebulae and just run it on that.


No, James. That is not the solution. Far too easy lol

listentoaheartbeat wrote:
But I will give it some more thought, too.. smile


That's more like it thumbs up hihi
boramx
I'm thinking Ardcore sketch.... hmmm.....

FWIW I've had occasion to use URN in MAX w/the ES8 and even used a pulse from my modular to reseed it.


it is rather useful...



my understanding of the Marbles Mutable module is that you can input an "array" of notes and the more you play them the more you bias the "coin toss". not the same thing but cool.
Navs
I'll have to check it out. I imagine that sort of biasing - memory - is much easier done in code rather than using simple offset and attenuation of the sample fodder.

Another thought I had for an analogue solution/non-software would be latches that shut, toggle switches. Once used, they get turned off. Off course, they could still be selected but would return a zero result. You'd then need a window comparator to tell your pointer to keep searching for another available value.
MUFF WIGGLER Forum Index -> Modular Synth General Discussion  
Page 1 of 1
Powered by phpBB © phpBB Group