Psychtoolbox is a popular MATLAB toolbox for neuroscience and psychology experiments. Building experiments in MATLAB with Psychtoolbox allows a degree of flexibility and precision that is essential in many research niches. However, it can be a technical process—tricky and time consuming even for experienced users. Redundancy is also a problem as code for stimuli and functionality needs to be continuously refactored across experiments and reinvented across labs.
Build and run an experiment in PsychBench by writing a short script. Make objects of various types (.g. picture, text, sound, keyPress, etc.). For each object, you can specify parameters and options by setting properties using dot statements. Lots of properties are possible but for any given experiment you can omit most to leave them at default values.
The script below would run a (very) simple experiment consisting of two repetitions of three distinct trials, all in random order. In each trial, a picture of an animal shows at a height of 10 degrees visual angle. The picture stops showing when the subject presses any key. Experiment results report which animal was shown (picture file name) and response latency for each trial.
Some compact Psychtoolbox code to run the same experiment—with the same timing precision and error handling, and assuming MATLAB imread loads the pictures with no fuss—would be:
The take-away is that with PsychBench you work mainly at the level of stimulus and experiment concepts while much of the technical lifting is automated underneath. Meanwhile the precision of Psychtoolbox is preserved because underneath is Psychtoolbox code.
PsychBench comes with a library of open-source object types, including not just the basics but niche stimuli as well.
We add new object types regularly. Please contact us with requests.
If the library doesn't have the stimuli or function you need for an experiment, you can write your own code in MATLAB + Psychtoolbox. The approach is to write it as a new object type—this allows you to use the code anywhere in any experiment by making objects of the type, as well as have it work with all core functionality (timing, degrees visual angle, core visual options, staircasing, etc.). All the standard types that come with PsychBench are open source, so you can use them as examples and/or build off them.
PsychBench's programming framework streamlines making a quick type for your own use. Alternatively you can invest a bit more time to make a durable type which is more flexible and has a fuller interface for an open range of users.
You can share a type you've made with other people by zipping the type's folder and sending it. To add a type you have received, just copy its folder into your "local element types folder", then call pb_addPath to refresh PsychBench.
PsychBench has been supported by