I’m trying to launch video file 1, 2, 3 when the keyboard 1, 2, 3 is pressed.
I want these 3 files to be stored in a single output node. In that way I can watch whichever file I want to, by ‘keyboardin’ CHOP. And I’m wondering with 2 things.
-What kind of node can store 3 TOP files altogether?
As far as I searched Composite TOP does it, but only under the graphical distortion options. I want the original videos to be played without distortion when the defined key is pressed. But when more than 2 keys are pressed together, distortion should appear.
-So I guess Python code will do the work, but I’m totally ignorant about this language for this moment.
Any kind of advice will save me.
Thanks.
Hey,
welcome to the TouchDesigner Forum!
you can approach this with a combination of Switch TOPs, the Keyboard CHOP, most likely the Fan CHOP, Math CHOP and a Logic CHOP.
One question, what happens if no key is pressed? Is the output black?
Best
Markus
So this approach uses a single python expression as a utility function but is otherwise solely based on operators that I mentioned in the last post.
The main idea here is to look at your task:
- play a video when a keyboard key is pressed:
1.1 create 3 MovieFileIn TOPs and combine them with a Switch TOP
1.2 control theIndex
Switch TOP parameter with a channel derived from the Keyboard CHOP going into a Fan CHOP (https://docs.derivative.ca/Fan_CHOP). - play 2 videos when 2 keys are pressed and combine them with a Composite TOP
2.1 create 2 more Switch TOPs to select which video should play when 2 keys are pressed
2.2 to control these Switch TOPs, append a Logic CHOP (https://docs.derivative.ca/Logic_CHOP) to the KeyboardIn CHOP and select as theChannel Pre OP
parameter optionLast Two On
2.3 delete all channels that are 0 and use the remaining 2 channels to drive theIndex
Parameters of the 2 Switch TOPs
2.4 use a Math CHOP where you add all KeyboardIn CHOP channels and another Switch TOP to switch between the single playback and the multi playback mode - If no key is pressed, switch to black
3.1 after the Single/Multi Switch TOP, add a level TOP and control itsLevel
parameter with a channel that comes from adding all KeyboardIn CHOP channels together.
Hope this makes sense
Best
Markus
keyboard123.tox (1.8 KB)
2 Likes
Than you very much, this solution will work perfectly for my project.
I’ll try my best to become able ton help others someday!
Best.
1 Like