Calendar Latest Topics

  Author   Comment  

Junior Member
Posts: 1
Reply with quote  #1 

I was wondering if it is possible to program a task with ML in which a video can begin at any random timepoint and play for a fixed duration (such as 15 sec). My paradigm involves one stage in which a monkey chooses to continue a clip, rewatch a clip, or play another random 15 sec clip sampled from a random, longer video. This is followed by the presentation of the appropriate clip.

Thank you so much!

Posts: 971
Reply with quote  #2 
In the old ML, you can change the starting point of a movie by using the 'MovieStartFrame' option in toggleobject().

The old ML can manipulate movies only frame by frame, so you will need to do some extra calculations with the movie's frame rate and your monitor's refresh rate, in order to jump to the right position and play for the duration that you want. One concern in doing this with the old ML is that it has to load the entire movie frames on the video memory beforehand. Depending on the sizes of your movies, the old ML may fail.

With the new NIMH ML, the job would be easier. You can write a timing file like this.

----- Beginning of example code -----
mov1 = 1;  % task object number in the condition file
mov2 = 2;

toggleobject(mov1);  % turn on mov1
idle(15000);         % play for 15 sec

choice = 1;  % variable that stores the subject's choice
switch choice
    case 1  % continue the current clip
        rewind_movie(mov1,15000);  % jump to where mov1 ended
    case 2  % rewatch the current clip
        rewind_movie(mov1,0);  % jump to the beginning of mov1
    case 3  % play another movie at a random position
        rewind_movie(mov2,floor(2*rand(1))*15000);  % jump to either 0 or 15 sec of mov2
        toggleobject([mov1 mov2]);  % turn off mov1 and turn on mov2
idle(15000);  % play for another 15 sec
----- End of example code -----
Previous Topic | Next Topic

Quick Navigation:

Easily create a Forum Website with Website Toolbox.