How to load different videos based on user's input from a collection of videos

Hi I am a beginner and trying to use touchdesigner for a use case.
I have a use case where I need to play different video based on the user’s input provided by button click or through speech.
For example a user want to know about the notable work of a persona (A celebrity lets suppose) that is initially interacting with him.
We already have the videos about the notable works and just need to load the particular video if user press a button or asks.

Welcome to the forum @ankit_kumar.

Have you worked through any tutorials yet? There are some pieces listed here already:
https://derivative.ca/resources/other

And a whole lot of tutorials posted here:
https://derivative.ca/tutorials

Playing your video based on a button click is pretty straight forward, but using voice recognition is a little trickier. Do you have a particular voice recognition library you’re thinking of using, or another tool that you’ve already selected for this process?

It’s always easier to help someone here once they’ve got a start on their project and then need a push. If you can get something started for the button based interaction you’re looking for, then post when you get stuck folks should be able to help you get the extra mile. :slight_smile:

Thanks Matthew for your help.
Yes I was going through the touchdesigner tutorials but it will take a lot of time.
I was looking for some resources where I can learn and do my work without covering all the material in touchdesigner as it will take a lot of time to learn everything first then solve my problem and I was unable to get something where I can learn with small exercise with each topic.
Its kind of funny that everything is available here what I was looking for and I could not find it:slightly_smiling_face:

Hi @ankit_kumar

Look over this example:
base_button_loads_video_example.tox (4.3 KB)

The related concepts are buttons and UI elements, python scritping, project organization and layout, and replicators. This is a pretty fast example of the kind of approach many would take, and it should give you some ideas about how you might start with the movie loading portion of this.

The voice recognition is a whole different element in there, and something that’s not built into TouchDesigner - though there are lots of ways you could make that work.

Hope this helps you get started.

Hi Matthew,
How can I use speech recognition in touchdesigner?
I am planning to use speech_recognition library in python so that I can instruct moviefilein to change the videos based on voice command.
The problem in touch designer I am facing is how can I take voice input from ‘audio file in’ to my script to apply speech recognition.
And also how to keep my script up and running so as soon as I get any voice input, I process it.

Hi @ankit_kumar,

Python’s execution in Touch is blocking - meaning that when you’re running a python script you can create stutters or stops in your project. The typical pythonic approach to this would likely not work in Touch - a while loop that’s listening to your mic input will make touch look like it’s frozen. Instead you would probably have better luck running the python portion of this outside of touch, and then sending information from that separate process over to TouchDesigner with a TCP or UDP library.

There are two other threads you might consider looking over for more ideas: