Shuffel Position of video

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

thanks, that works fine. Now I am trying to pulse the cue as soon a value in the table changes. This doenst pulse the cue. Then I tried to connect the table information of one cell (with select) to a logic and set this to “on when value changed” but this doesnt pulse either. Is there some way to get a trigger out of if the caue changes?

A DAT Execute can execute a script when a table value changes - though you’ll have to dig into some python for this one.

I manged to get a trigger now with help of an expression-CHOP, that triggers when my count gets to “0” now. But thanks, I will slowly try to find my way through python. By the way your video-tutrial are amazingly well done!

Glad you’re making progress!

thanks for this thread, I’m struggling on the same topic:

can’t figure out how to change moviefilein number
using a Costant CHOP or a Count CHOP:

[code]
def onValueChange(channel, sampleIndex, val, prev):
myvideo = ‘moviefilein{}’

op( 'myvideo' ).par.cuepoint = val
op( 'myvideo' ).par.cuepulse.pulse()

return
[/code]

hey Vertexshining, the val you’ll get from a CHOP is always a float (for instance 2.0), so first we make it an int (2) and then a string so we can combine it with string ‘moviefilein’.
Also as you declared myvideo as a variable, don’t put quotes around it in the op path

[code]
def onValueChange(channel, sampleIndex, val, prev):
myvideo = ‘moviefilein’ + str(int(val))

op( myvideo ).par.cuepoint = val
op( myvideo).par.cuepulse.pulse()

return
[/code]

this is totally fine,
what I can’t figure out is how to point that
val is coming from a different channel of the same chop
as in the attached example

[code] myvideo = ‘moviefilein’ + str(int(val0))

op( myvideo ).par.cuepoint = val1
op( myvideo).par.cuepulse.pulse()

return[/code]

thanks so much!
shuffle_multi-movie_position.tox (2 KB)

not sure I understand correctly what you want to build but see example attached.

see here how to get channels/samples from a chop:
docs.derivative.ca/CHOP_Class

also if you need the channel name/index that has changed, that info is in the channel object returned by the

def onValueChange(channel, sampleIndex, val, prev): callback.
See docs.derivative.ca/Channel_Class

so in your example channel.index will be 0 or 1, channel.name will be ‘chan1’ or ‘chan2’
shuffle_movie_position_v2.tox (2.01 KB)