Page 1 of 1

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

PostPosted: Thu Sep 06, 2018 4:10 pm
by Selmabrd
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 ;)

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

PostPosted: Wed Sep 12, 2018 9:14 am
by rob
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.

https://docs.derivative.ca/Shuffle_CHOP

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

Cheers,
Rob

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

PostPosted: Wed Sep 12, 2018 9:31 am
by rob
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.

Cheers,
Rob.

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

PostPosted: Sun Sep 16, 2018 8:18 am
by Selmabrd
Thanks alot, haven't tought about this, very clever !

Cheers !
S.