Getting started / Making an experiment

Custom stimuli – New element types

Making/Editing element types

If the element type library doesn’t have the stimuli you need for an experiment, first make sure PsychBench is up to date using pb_update. You can also email us at contact@psychbench.org to request an element type.

Otherwise you can write your own code for stimuli in MATLAB + Psychtoolbox. Almost never do you just need code that runs once in some trial. Generally you want code that repeats across multiple trials and with parameters you can control (e.g. stimulus features). You also often need part of your code to do work before or after trials so the part during trials can run fast and not impact frame rate. And you don’t want to re-invent the wheel when it comes to all the core functionality PsychBench already handles (timing, visual options, staircasing, results output, etc.).

To make all this easy, the approach is to write your code as an element type in your library. You can then use it anywhere by making objects of the type, parameterize and get output from it using object properties, and have it click with all core functionality. You can make a quick type for a limited number of experiments, or you can make a durable type with more flexibility and a fuller interface for other users. All the element types that come with PsychBench are open source, so you can use them as examples and/or build off them.

See Element type programming manual.pdf for more information. There is also a local copy in <><PsychBench folder><>/docs.

Sending/Receiving element types

To share an element type with other people, just zip its folder and email it. To add a type you have received, just copy its folder into your local element types folder, then call pb_addPath to have PsychBench find it.

You can also contribute a type to the library that comes with PsychBench. Please email us at contact@psychbench.org. We would be happy to credit you. And thank-you!