ISO: Router that can swap a random pair of in→outs?

I had great success with this solution for a module that can randomly route N inputs to N outputs! (I used the technique to record a whole upcoming album!)

I have a new closely related problem to solve: I’m looking for a way to route N inputs to N outputs, and on trigger, choose a random 2 in→out routings and switch them, leaving the others unchanged. On the next trigger, a new random pair of routings would switch, and so on.

Similarly to the first topic, a carousel module comes close, but I’d like the routings to be “mixed up” not sequential.

Can one of the modules in the previous topic be modified to do this? Is there something else?

This NullPath module might be promising, but I can’t understand it… Maybe the Cage?

I appreciate any guidance!

1 Like

I’m not a 100% sure I understand your need, but if I do I think you’ll be able to use one of the following:

The Bogaudio::Matrix88 with the MX88CV expander: BogaudioModules/ at master · bogaudio/BogaudioModules · GitHub

The VCV::Octal Router (commercial): VCV Library - VCV Octal Router


It looks good and I thought of that construction first. I think it’s not what the OP is asking for, although I’m not realy sure what he wants. In your construction the pairs of inputs are fixed, but the OP wants them shuffled, I think:

choose a random 2 in→out routings and switch them, leaving the others unchanged. On the next trigger, a new random pair of routings would switch

But maybe I’m wrong and not understanding what he wants. So if he does want fixed pairs then your solution is good :+1:

1 Like

n=16. I wanted to hurt my brain so I put way too much time into this, which I’ll probably never use. The only aspect OP might not like is the (kinda) null case, where it switches the same channel with itself, so no swapping. That would be easy to adjust on the random generation side.


Sorry, yes, correct, I do not want fixed pairings. The routings that switch should be randomly selected and independent of each other. For example, on trigger, I want something like:

1→A | 2→B | 3→C | 4→D


1→A | 2→C | 3→B | 4→D


1→A | 2→C | 3→D | 4→B


1→D | 2→C | 3→A | 4→B


1 Like

Fascinating, though I don’t think I understand it. Could you provide a .vcv patch file somehow so I could tweak?

This does sound like an interesting module to develop, if it doesn’t exist already among the 2848 modules already in the library. Sometimes I think creating a new module is faster than finding existing functionality, but that only makes the problem worse! :rofl:


I think Entangle is the way to go :

And it looks cool.

Or…simplified @waldo

1 Like

Oh, you forced me to make a patch storage account, ha ha!

Uh, if you want any hints to “understand” it…the one interesting programmatic thing that occurred to me is that – we have 2 random voltages selecting the 2 channels to swap. One way to swap the voltages is just to get the absolute value of A-B, add that to A, subtract it from B, and voila. (Even though I don’t use an absolute value function – that’s the job PMM is doing).

And I was sure docB’s new TXVI module would be useful. I’m finding a way to use that every day the past week. Cheers!

It does look cool! But it’s randomizing the whole array, no? OP wants just 2 channels swapped and no more.

Ah now I see if he had 80 inputs after a trigger he only wants 2 of the 80 to swap and the rest to stay the same, that’s what he meant with a pair :blush:

WOW. This is incredible, thanks for devising this. I’m impressed.

I hate to say it… but this is a step short of what I was trying to describe.

Your patch swaps a random two channels, but on the next trigger, I want it to swap another random pair from that last state, rather than “resetting” to 1→1, 2→2, etc…

I’m thinking this patch could be modified to sorta “save its state” and randomize step by step, eventually producing an entirely mixed up routing, pair by pair.

Oh, ha, that is certainly harder. Probably just a matter of adding another 18 modules to the right of what I banged together. Sounds simple enough, ‘capture the last state, then make the next change from there’. But it reminds me of the very complicated things I made a few months ago to make random-based arpeggios where a note would not be repeated twice in succession.

We all want random, but juuuust enough random.

One thing I can rule out is just patching the result values from the right side back into the IN of the TXVI module. It doesn’t work like that (similar to how docB’s Faders module doesn’t capture the mod input for storage).

@cotterjk do you ever want an input swapped more than once?

1/a 2/b 3/c 4/d 5/e 6/f

1/c 2/b 3/a 4/d 5/e 6/f

1/f 2/b 3/a 4/d 5/e 6/c

Or do you want all the inputs guaranteed to be swapped after n/2 triggers which would require swapped inputs be excluded from future swapping?

No exclusion necessary. Every input is eligible for a swap, even if it was just moved on the last trigger.

1 Like

Oh yeah, that or docB’s Formula One. This is definitely the solution. With an array data type, it’s relatively straightforward.

1 Like

Yes…flexible solution

I’ve put this thread on my Watch list because it may give me some hints about how to make a pattern like change ringing or method ringing of church bells. Unlike a carillon where the bells remain still and relatively light-weight clappers strike them in any arbitrary order, the bells used in change ringing are swinging back and forth, and their inertia restricts how soon they may be rung again, typically shifting by no more than one place in the sequence (if at all).

See Change ringing - Wikipedia and Method ringing - Wikipedia

Here is a sample sequence, “plain hunt on eight bells”:

1 2 3 4 5 6 7 8- start in rounds (rounds is the descending sequence of bells)
2 1 4 3 6 5 8 7
2 4 1 6 3 8 5 7
4 2 6 1 8 3 7 5
4 6 2 8 1 7 3 5
6 4 8 2 7 1 5 3
6 8 4 7 2 5 1 3
8 6 7 4 5 2 3 1
8 7 6 5 4 3 2 1 – reverse rounds
7 8 5 6 3 4 1 2
7 5 8 3 6 1 4 2
5 7 3 8 1 6 2 4
5 3 7 1 8 2 6 4
3 5 1 7 2 8 4 6
3 1 5 2 7 4 8 6
1 3 2 5 4 7 6 8
1 2 3 4 5 6 7 8 – finish in rounds

Each note swaps places with one of its neighbours, so it’s like a braid pattern.

Here’s another pattern with 6 bells, with two of the strands highlighted:

I have a feeling it’s going to end up being a complicated arrangement of A/B switches, shift registers, S&H, flip-flops, etc. — Oh, I may have an idea. Something to do with two shift registers, one that keeps track of notes “travelling” to the right, another for notes travelling to the left, and they somehow get “interleaved” — Nope. It’s gone now.