Login | Register 
FEATURES
APPLICATIONS
DOWNLOADS
EDUCATION
BLOG
WIKI
FORUM
STORE

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

Still a little green? Ask your beginner's questions here

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

Postby Selmabrd » Thu Sep 06, 2018 4:10 pm

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 ;)
Selmabrd
 
Posts: 9
Joined: Fri Mar 16, 2018 12:45 pm

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

Postby rob » Wed Sep 12, 2018 9:14 am

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
User avatar
rob
Staff
 
Posts: 1547
Joined: Tue Nov 13, 2007 1:14 am

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

Postby rob » Wed Sep 12, 2018 9:31 am

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.
Attachments
reshuffle.tox
(838 Bytes) Downloaded 27 times
User avatar
rob
Staff
 
Posts: 1547
Joined: Tue Nov 13, 2007 1:14 am

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

Postby Selmabrd » Sun Sep 16, 2018 8:18 am

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

Cheers !
S.
Selmabrd
 
Posts: 9
Joined: Fri Mar 16, 2018 12:45 pm


Return to Beginners

Who is online

Users browsing this forum: Bing [Bot], matthewwachter and 6 guests