Example 2: Visual Speller
In this part of the visual speller example, we will use the Stimbox toolbox for stimulus presentation. Stimbox was developed at the Donders Centre for Cognition and makes use of Psychtoolbox.
Stimbox works with a so-called agenda. The agenda may contain different types of stimulus content: for example video or audio content. In addition, the agenda contains a timeline, defining which stimulus is presented at which moment in time. When using Stimbox together with BrainStream, it is best to define an agenda prior to each sequence and then run the contents of the agenda in a looptick function.
Preparing a stimulus sequence
Just like in the previous examples, the startSequence marker triggers the execution of the initSequence function. This function creates a stimulus dictionary (i.e. each row and column of the symbol matrix is associated with a unique number). In this part of the visual speller example, the initSequence function is followed by the function defineSpellerAgenda. This function prepares a Stimbox agenda for the coming sequence. The agenda is a Matlab structure with the name content. After this function has been executed, the content structure contains the following information:
1. content.stimSeq: Stimulus sequence (number of symbols x number of time points)
The stimulus sequence defines the visibility of the speller symbols at the different time points, where 1 means visible and 0 means invisible. Because the speller matrix should be on the screen the entire time, all symbols of the matrix are set to 1 at every time point.2. content.timeSeq: Time sequence (number of timepoints)
Sequence of time points (in ms) at which flashes begin and end, therefore the number of timepoints is twice the number of flashed rows/columns. In the block file is specified that each flash lasts 150 ms (Ton = 0.15) and there is a 50 ms pause in between flashes (Toff = 0.05). Thus, the sequence of time points begins as follows: [0 150 200 350 400 ...].3. content.markerSeq: Marker sequence (number of timepoints)
Sequence of markers to be inserted at each timepoint. This is a stim_# (where # is the number identifying the flashed row or column) marker for each flash onset and the highlightOff marker for each flash offset.4. content.featSeq: Feature sequence (number of symbols x number of time points x number of features)
Here you can indicate how features of the stimuli should be manipulated at each point in time. In this example, for all even timepoints (i.e., when a stimulus is turned off), the color feature of all symbols of the matrix is set to light grey. For all odd timepoints (i.e. when a stimulus is given), the color feature of the symbols in the row or column that is flashed is set to white. For the video type content, features like for instance rotation, alpha and color can be defined. This information is stored in the featSeq matrix third dimension.
Running a stimulus sequence
After the defineSpellerAgenda, the function runContents is executed. This is a [.DocsSectionsLoopTick looptick] function designed to be used in BrainStream to execute Stimbox agendas. At each call, the runContents function plays the stimulus scheduled for this iteration and subsequently checks for new information from the BrainStream side. BrainStream may send commands to clear or discard the agenda, thereby ending the stimulus presentation, or to change the stimulus sequence, for example from random to ordered flashing of the rows and columns.