Shuffel Position of video

Hello,
I am an Isadora-User but just thinking to Change to Touch. Now I am trying to rebuild my videoiinstallation in Touch. I get along quite good but get get any further now.

My aim is to jump to 20 specific positions in a video. These 20 Positions should be repeated, but every time in a new order. Its should be like a kind of shuffle. I found out that I should use a table and reorder it, but how exactly do I do this and how do I get the Values from the table to the cue point in my moviein-TOP?

I woud be happy about any answers!

There are a number of ways to tackle something like this.

One way would be to use your table, and a select DAT - the select DAT can parse out just a single row. From there you could use python refs to get the information from your select into your moviefilein TOP.

You could do something similar to the above, but use exports instead. Export tables are a little different to set up, but are more efficient than python refs.

Another route would be to use some python to set pars - this is probably the route I’d go.

Do you have a simplified example of what it looks like / how it needs to behave? Folks here are pretty good about offering solutions if you post a sample network.

there are sooo many ways you could do this.

Here’s some pointers:

  • in your moviefileinTOP your have cue point and cue pulse, these will be useful to retrigger your video at specific points
    *connect your movieinTOP to a infoCHOP with index_fraction in scope to see where the video is at
  • you tableDAT should hold your 20 rows each with the fraction of the video where you would like the cues to be
  • you can randomize the order with sortDAT with order set to “random”
  • each time you change the seed, the order will randomly change

I would probably just connect the infoCHOP to a chopexecutDAT and do the whole logic in python. So on value change, check if val is in the range of one of your cue points in the table, if so trigger the next cue in the list. Could use a constantCHOP or store vaiable to keep track of which cue is currently playing. If it’s the 20th cue, the script should increment the seed of the sortDAT and start over to the first cue.

You could also use a mix of dattoCHOP, selectCHOP, logicCHOP and countCHOP but it seems les obvious…gets kinda more complicated than doing it in python IMO

Are your cues evenly spaced on the video lenght or custom?

You should really post the network of what you have for better help.

ok, thanks for your reply. Here is the file I started with. What I dont find out is how to get the selected number from the select1-DAT into the cue point of the moviein-TOP. The second problem I know how to solve is: When the maximum of the Count1-Chop is reached. in this case “9”, then the table should be reordered in the sort1-DAT. I think I can do this by changing the seed of the sort1_DAT, but how? It should be something like" if count1=9, then change seed".
shuffle_test.toe (4.92 KB)

thanks sidecarstudio, I will check out whot you suggest. Dindt see your post in time before posting my new one with the exemple-file.

@ sidecarstudio
I checked you description. Since I a not yet familiar with python I would lik to find a possibilty without, if possible at all. The cues are not evenly spaced on the videolenght. Actually the video contoins 20 videos in a row. The reason why I put them together is, that I dont need to load all the 20 videos, whcih would cause a lack in perfomance, having them running all at the same time in the background. But maybe there is also a better to do this wthout problems in perfomance. The main idea is just to have all 20 movies played in random order and after all of them are played play them in a new order.

Take a look at this example.

A folder DAT grabs a set of video files. A sort DAT is set to random to change their order.

A moviefilein TOP is used to playback video, an info CHOP checks the play position of the video file. A Count CHOP is used to increment files. Finally a CHOP execute is used to change which file is played back, and add a new seed value for a new random order.

This is aimed at you description of playing back a set of video files in a new random order each time the playlist completes.
shuffle_test_tox.tox (1.38 KB)

Thanks again for your effort. I tried out your exemples for the random/shuffle function with the movie-folder. It helped me a lot! In some cases I still had problems to get it work. But before I go deeper into that I thought for therms of instant change of the movie it might make sense if I go back to the idea to jump to cues within the long-version-movie. Out of all your suggestions I got something workig, but just missing the point how to get the cuepoints from my dat-Table into the cue-position of my movie. I would be happy if someone could have a look at this. Here is my file.
shuffle_movie_position.tox (1.93 KB)

You can get them there two ways. One would be to set up an export table:

derivative.ca/wiki088/index … DAT_Export

The other would be to use a python ref:

op( 'select5' )[0,0]

You can see examples of both in this tox:
shuffle_movie_position_cuepoint.tox (2.19 KB)

There are a few additional things to consider. This might be a circumstance where you’d be well served by using a timer CHOP and a segments table. You can find an example of this from the help menu - look for op snippets. Op Snippets has a host of code examples that are excellent resources for finding your way around Touch and the operators inside.

Looking at this example I can see that your use of count CHOPs is causing everything down stream to cook all the time. This isn’t bad in itself, but touch as an environment is slightly different from others. It’s a pull based system and this kind of cooking will add up and cause performance issues in the long run.

Above just setting the cue point, you’ll also end up wanting to to pulse the cuepulse parameter of the moveifilein TOP. Just setting the cue point doesn’t reload / cue the video automatically. Here’s a look at your same set up done with CHOPs and a little python:

shuffle_movie_position_cuepoint_var2.tox (1.96 KB)

Here you’ll see a pattern CHOP is used to create your look-up points. A Sort CHOP re-orders those. A lookup CHOP takes a look up value and compares that against an array - in this case the count acts as the look up index for the sort CHOP. A null is used to help stop unwanted cooking (you’ll notice that its cook type is “selective”). Finally a CHOP execute sets the cue point on a video, and cues the video.

All of that said, I still think a timer with segments might be a solid way forward as well. The important thing to remember / keep in mind here is that you can use the timer to drive the index of the video file - rather than letting it free run.

Hope that helps.

wow, the first file works as I wanted it to be. But you are right. Te video needs to be started every time I change the cue point. Is there a chance to give the pulse button a signal to start the movie as soon as the cue point is changed?

Unfortunately the second file doenst change the cuepoints. And it show some errors in the chopex1 and chopex2. Both say: "cannot find function named valueChange (project1/shuffle_movie_position2/chopexec1).

Ahh… you must be using 088.

Apologies - I made the example in 099.

Var2 for 088:
shuffle_movie_position_var2_088.tox (1.94 KB)

To pulse you can use a null CHOP attached to your button, and then export the value to the pulse button:
shuffle_movie_position_export_pulse.tox (2.28 KB)

thats it! I updated to vesrion 99, and then it worked. There is only one point I guess I didnt write clearly: I dont have a rhythmic cue values, they can also be 0.1,00.23, 0.27, 0.34 … So I guess I need to go back to the table. I just inserted the chopex2 with it script “op( ‘moviefilein1’ ).par.cuepulse.pulse()” from the file with the pattern to the file with the table and linked it to the countchop, AND THATS IT! Thanks you very much. I will now need to look at the the timer and understand how that works. But were already a great help. Also the hint with the op snipped is a good adivce.

I moved to Touch from Isadora several years ago now, so I can certainly appreciate the learning curve.

You might also check out these resources for finding your way around touch:

The open source book by elburz
[url]GitBook - Where technical teams document.

Lots of hands on practical focused tuts that I’ve done:
[url]https://matthewragan.com/teaching-resources/touchdesigner/[/url]

A top to bottom look at python in Touch:
[url]https://matthewragan.com/teaching-resources/touchdesigner/python-in-touchdesigner/[/url]

I should add that the look up method will still work with CHOPs.

You can convert your table DAT to a CHOP and use that instead of the pattern CHOP.

How did you export null1 to the cuepoint of the moviefilein? I cannot drag a value from null1-table. And If I just write null1 as an expression it doenst work.

Python references from tables read as:

op( ‘string_name_of_dat’ )[ row, column ]

If your operator is ‘null1’, and the target value is in row 0, column 0, the ref would be:

op( 'null1' )[0,0]

It’s important to note that the name of the operator needs to be enclosed in quotes.

If you’re talking about exporting from the null CHOP, that looks like:
export.gif

I understood how in general exporting from a chop works. But in my exemple I have a table in a DAT with different values and and somehow I cannot drag a specific row/column of it. (see file “DAT”)
If I look at the last file you send me the export look like this.(attached file “movie”) How did you do that?
DAT.JPG
movie.JPG

Ahh. Apologies.

Table exports follow this formula:
derivative.ca/wiki088/index … DAT_Export

You need the parameter name which can be found by hitting the small plus button next to an operators paramters - the lower case name on the left hand side of the parameter window. The Trim Start parameter, for example, is tstart.

The other important bit is to turn on the export flag on your table - the small green circle on the bottom right when the operator is not viewer active.

I am getting forward on my project. I am am now setting the trim to specific frames. All fine, bit “hitting” the with pulse my the Button1 doesnt work. The index doesnt change to 0. The behaviour I want is like pressing the pulse button. What am I doing wrong?
cue_pulse.tox (6.65 KB)

If you change your cue point type from Frames to Fraction you should see something closer to what you’re expecting.

Capture.PNG