Search the Legacy Support Archive (up to v2020)
  1. Read-only archive (2005–2024). Posting is closed. Need help with MediaLab or DirectRT 2027? Email service@empirisoft.com.

    All words · “exact phrase” · -leave out

    Advanced search

Count button presses while watching video (case 3988)

  1. #1

    Count button presses while watching video (case 3988)

    I'm trying to add a feature to my experiment in which participants view a video and press a button on the keyboard every time they see something they deem 'important.' Does anyone know how I can record the frequency and timing of these button presses?

  2. #2
    Hi admitchell!


    You should be able to accomplish this by using DirectRT in conjunction with Medialab. First, make sure that your video is compatible with Windows Media Player as an easy test to see if DirectRT will handle it. Save your video file; let's call it "video1.mpg"? for this example. (Side note: You can save it anywhere, but it's preferable to keep it in a folder named something like "stim"? in a folder for all of your DirectRT files for this experiment.)


    Next, create a very simple Direct RT input file to tell it to play your video; I've attached an example .csv file for your reference. The most important thing is to type _<name of movie file>( _video1.mpg for us), in the stim column of the file. Because you want to record multiple key presses, you will define what keys are acceptable in the time column. The current entry of "rt:any"? means that any key pressed on the keyboard will be recorded. If you want to define specific keys, you can find a list in the DirectRT manual here: http://www.empirisoft.com/directrt/help/directrt_key_codes.htm


    You can then pass this file into a Medialab questionnaire by selecting DirectRT item type. When you run MediaLab, it will then pass control to DirectRT to run the video and record the keypresses. Importantly, you will find the data for all of the keypresses for a given video in the log folder in the Data folder for your DirectRT files.



    I hope that this helps!

  3. #3
    jarvis Blair Jarvis, Administrator
    If you are also interested in capturing additional keypresses (beyind the first) with the same stimulus, you could add additional columns in the input file. If you repeatedly add the stim, loc, time sequence of "~", "0,0,0", "rt:57,28>-100" you will allow for multiple presses of the SPACEBAR without adding anything visual to the screen (just a blank text stimulus). The second code, "28" is the ENTER key and the negative value of -100 means the skip to trial 100 will be executed immediately--breaking out of the trial without requiring the subsequent keypresses.

    Hope that helps!