Python expression to sample "n" samples of each CHOP?

Hello TD programmers !
For a project with I need a way to reorder a signal in such a way :
I have two chops with 3 channels each (R,G,B)
I need one chop with 3 channels, result of the two chops interweaved.
For example : 12 samples of the first CHOP, 25 from the second CHOP, then the next 12 samples from the first; then the 25 next from the second…
Let’s say I want to do this 50 times.

It’s easy to do with trim and splice CHOPS for a certain number of times.
For 50 I think I need python.
Any ideas?

Thanks :wink:

Consider using the Shuffle CHOP which lets you split up a channel into a series of smaller channels.
You can use the Shuffle CHOP to join groups of channels again.

Another example can be found from the TouchDesigner menus:
Help -> Operator Snippets -> CHOP -> Shuffle.


In the attached example, I’ve interleaved 3 rgb channels,
alternating between 12 samples of the first set, and 25 samples of the second set.

I ended up using Shuffle CHOP and Join CHOP.

reshuffle.tox (838 Bytes)

Thanks alot, haven’t tought about this, very clever !

Cheers !