Miscellaneous Features

These features are documented here despite the fact that not as commonly used as the others discussed in this manual. Sometimes when people get customizations to MediaLab done, they are very useful to a lot of other users and so they get worked into the manual. Other times, well… they'll probably gather some dust. But just in case somebody else might be able to benefit from them, here they are:

 
Using Responses from MediaLab as Stimuli in DirectRT

At some point you may want to use a subject's answer to a scale response or fill-in-the-blank item as a stimulus in DirectRT. For example, in MediaLab you could ask a series of fill-in-the-blank items asking subjects to enter foods that they like. Or you might ask them to indicate their race using a scale response. Then in a DirectRT session, you might want to display these responses as stimuli (e.g., as primes or targets in a priming study). For fill-in-the-blanks and scale responses, you can specify a file name ending with .txt  in the File Name field to have MediaLab save the response in the file you specify. This will cause MediaLab to save the subject's response preceded with a "~" symbol so that DirectRT will recognize that it is text for display purposes. Then, in DirectRT, you can specify that this text be displayed as a stimulus by using the "&" symbol (which tells DirectRT to read a single line stimulus from a text file). So if you have a MediaLab question that asks subjects their race called "race" you could enter something like "c:\race prime study\stim\race.txt" in the File Name field. Then, in your DirectRT input file, you could refer to "&race" as a stimulus. When DirectRT finds this, it will open the race.txt file that MediaLab created, and will present the subject's response as the stimulus. See the DirectRT documentation regarding "Input Files" and "Stim" types for more detail.

 
Adjusting Speaker Volume Automatically During Session

Sometimes you will have multiple media clips in your session and they vary in volume. Some play too loud, others not loud enough. Now you can embed an executable item at any point called volume.exe located in the C:\MediaLab\Utilities\Sounds folder. Copy this file into your experiment folder. Anywhere in your experiment add an executable item and in the File Name field, type volume.exe. In the parameters field enter (c5) where 5 is a volume setting from 1 to 10. For max volume, enter (c10) and for min volume enter (c1). Any integer value from 1 to 10 is permitted. You'll get a brief, "please wait one moment" message while the volume is adjusted, after which you can click to continue.

 
Secondary Tasks - Requiring Participants to Respond to Probes

Visual, auditory and TTL signal probes can be launched at any time from your questionnaire. You can create a schedule of probes at either random or fixed intervals and get subjects' response times to the probes. The probe schedule can span multiple items as it runs independently of the experiment once launched. Response times are assessed using DirectX so their accuracy is very good.

To execute a probe task you create a schedule of probes in an Excel file. Each schedule may contain multiple sets of probes, with each set having an ID such as 1, 2, 3 and so on.  In a MediaLab questionnaire, we refer to this ID in the parameters of any item by saying "*1" or "*2".  That tells the Probe Generator which set of probes to execute.  The set will execute until completion which means that a single set can span one or many items in MediaLab.  You can have as many sets of probes as you like (Set 1, Set 2, Set 3 and so on).  However, you can only request a given set once in a session.  You might assign different probe sets to different tasks within the same session, or to the same task in different between subject conditions.

For detailed documentation and samples see:

http://www.empirisoft.com/support/showthread.php?p=826

Sending and Receiving Serial Data

Some external devices can emulate keyboard input so that input will be instantly recognized as key presses from a standard keyboard--they will just arrive much faster. For example, our DirectINTM Precision Button Boxes and Keyboards are all USB ready and send signals within 1ms that look like regular keystrokes to your computer. Some older devices though still communicate via the serial port. This section describes how you can get MediaLab to recognize and record serial port data.

Receiving a Single Response via Serial Port

As an alternative to keyboard input, you can receive input from external devices such as response boxes via the serial port. To do so you just need to create a file called comport.txt in your experiment folder and copy the following text into it:

comPort, baudRate, parity, dataBit, stopBit
1,19200,n,8,1
input code (1-255), response value (1-12)
1,1
2,2
3,3
4,4
5,5
6,6

You should not modify the first or third line. The second line represents the values of the variables listed on the first line. You can change any of these as necessary. The remaining lines tell MediaLab how to map incoming signals to response keys. On each line you can list a pair where the first value is the signal sent to the serial port (i.e., 1-255) and the second value is the response it should map on to (i.e., 1 to 12). In the example above, if MediaLab detects a "1" coming through the serial port, it will react as though the 1 or F1 key had just been pressed.

Receiving Streams of Serial Data

MediaLab can also accept and log streams of serial data from an external source. MediaLab will write the exact ASCII data to an external file named comdata.txt. To indicate to MediaLab that the serial data should be recorded, your serial device should be programmed to send out data packets that are surrounded in {} brackets as follows:

{
Hello World
This is data for MediaLab
}

The comdata.txt file will contain the data

Hello World
This is data for MediaLab

This function requires that you create a file called comdata.txt and place it in your experiment folder. If MediaLab sees this file, it will automatically watch for and save any serial data that is surrounded in { } brackets. In order for MediaLab to use the proper serial port settings, you should also include a comport.txt file as described above. If you do not want any key mappings, it could simply look like this:

comPort, baudRate, parity, dataBit, stopBit
1,19200,n,8,1
input code (1-255), response value (1-12)
0,0

Sending Streams of Serial Data

If you are using a comport.txt file, you can also send a string of data to the serial port by adding the string as a parameter value for any given questionnaire item.  The string should be enclosed within braces-{}- and angular brackets-<>- like this:

<{112340}> or <{RED}>

When included in the parameters for a 5pt scale response, for example, your parameters field might look like this:

(p5,<{SCALE1}>)

In this example, so long as you have a valid comport.txt file in your experiment folder (see above), then MediaLab would send "SCALE1" to the appropriate port at the onset of this scale response item. Again, if you do not want any key mappings, comport.txt could simply look like this:

comPort, baudRate, parity, dataBit, stopBit
1,19200,n,8,1
input code (1-255), response value (1-12)
0,0

See Also:

Receiving Responses Via TTL Signals
Receiving Response Via Serial Port