Psychtoolbox
Prerequisites
Hardware
- Mentalab Explore Pro Device: An Explore Pro biosignal acquisition system.
- Mentalab Hypersync Add-on: This hardware is essential for accurately synchronizing LSL markers from Presentation® with the Explore device’s data stream.
- Computer: To run Psychtoolbox, LSL, and data recording software for the Explore device.
Software
- Psychtoolbox
- Matlab
- LSL for Matlab
- LabRecorder or alternative software that lets you record LSL streams
How it Works
- Psychtoolbox: Runs experiments from user-written Matlab code and provides access to low-level hardware features to ensure very precise timing (sub-millisecond) and versatile usage
- Matlab: Psychtoolbox requires Matlab to run
- LSL for Matlab: The Matlab release for LSL allows users to open and view LSL streams to pull or push data (like Markers) from within Matlab scripts
- Mentalab Hypersync: The Hypersync suite is used to merge ExG data with event markers via LSL. Please follow the instructions delivere to you with you Hypersync hardware to achieve wireless, high-precision synchronization
Integrating with Psychtoolbox via LSL
Consult the HyperSync manual for achieving synchronisation between the Mentalab Explore amplifier and LSL.
In order to synchronize ExG data from the Explore amplifier with event marker data from Psychtoolbox, you can open an LSL stream in your Matlab script to push the event marker data to. Make sure to add the path to the liblsl-Matlab directory containing the Matlab interface for LSL if your script is running in any other directory.
% add path to liblsl-Matlab (necessary if the current working directory is not the liblsl-Matlab directory)
addpath(genpath('path/to/liblsl-Matlab'));
% load the library
lib = lsl_loadlib();
% create a stream info and outlet based on the stream info
stream_name = 'MyMarkerStream'; % set the marker stream name according to your needs
info = lsl_streaminfo(lib,stream_name,'Markers',1,0,'cf_string','myuniquesourceid23443');
marker_outlet = lsl_outlet(info);
This outlet can and should be reused in your experiments. When an event marker needs to be created, push the sample using your previously created outlet. Note that LSL will timestamp the sample when you push it so push_sample
should be called as close to the event (temporally and in code) as possible.
% push a marker to the marker_outlet with the current LSL time
marker_string = 'TestMarker'; % set the marker string value according to your needs
marker_outlet.push_sample({marker_string});
You can view and record the marker stream (named according to your given stream_name
) using LabRecorder alongside the EXG datastream (named after the Explore device) from the synchronized Explore amplifier to record synchronized markers from an experiment and EXG data.
If you need more information on how to use LSL in Matlab, please refer to the GitHub repository for LSL for Matlab and their examples:
- LSL for Matlab repository containing installation instructions
- Examples showcasing how to use LSL in Matlab
To ensure accurate synchronisation, you must use Mentalab Hypersync and follow the instructions provided alongside your Hypersync hardware.
Alternative (Legacy) Methods: Wired Triggers
While LSL with Hypersync is preferred as it enables fully wireless and highly accurate event marking, direct wired connections are also possible. Please refer to our Event Triggers page for further information.
For more information or support, do not hesitate to get in contact at: support@mentalab.com