Psychophysics Toolbox
Tutorials & Documentation
MEX & DLL files

Writing code from scratch is hard. It's much easier to edit an already working program that does something similar. We are building here a library of user-supplied programs that run real experiments and demos, as examples for others. Please share your working programs to help others get their experiments going.

We invite everyone to send software to the Psychtoolbox forum, which automatically archives your message and enclosure. (Please include the keyword DONATE in the subject, so we can all search the forum for software.) We'll add links here to software in the forum that appears to have enduring value.

Please put your software into an archive (stuffit ".sit" or zip are fine) before sending it to the forum. You can use the free DropStuff to make the archive. We've discovered that when the yahoogroups forum software receives attachments that are TEXT files (e.g. Matlab programs), it appends them to the email message. This is very inconvenient for would-be users of your software, since the file names are lost, the text of your program is line-wrapped (introducing Matlab errors), and illegal but invisible characters are inserted. The solution is to use DropStuff to make an archive, and email the archive, which preserves your software intact. Some email programs can do this automatically.

As it becomes more common to cite web resources, the thought that one's software could be acknowledged in print may induce more people to donate software as examples for others. This is new territory, in which everyone is still finding their way, but we're finding it natural to include URL links in our writing, so that, for example, one might say, "Our stimulus presentation software was based on Charles Collin's matpong.m table-tennis game <>."

Denis & David

Tutorials & Documentation

Programming vision experiments with Matlab and the Psychtoolbox - Ione Fine

Ione's lecture notes from her course on creating vision experiments using Matlab and the Psychtoolbox are available in PDF, RTF and Word formats. Appropriate for those with no experience programming, or skip the first eight chapters if you have experience.


You'll need the free Stuffit Expander program to unpack the enclosures in these donations. If you don't find what you're looking for here, you can search the forum. And if you end up writing it yourself, please consider sharing it with the next person, by sending it to the forum.

Calibration tools - David Brainard

Create a calibration file, dump its contents, and perform a simple linearity check. Assumes you have a radiometer interfaced to your computer.

Color lecture demos - David Brainard

Quick demos of some basic principles of color vision (color mixing, threshold measurement, etc.).

matpong - Charles Collin

A "video tennis" (i.e., Pong™) game for the Psychophysics Toolbox.

Use PsychSerial to control the ViewPoint eye tracker - Daniel Shima

I am attaching four files that serve as an intro and demo for new users of the ViewPoint eye tracker who want to communicate serially between it and Matlab. [IMPORTANT: You must use the PsychSerial.mex of the new Psychtoolbox 2.52. It reads binary and supports the new expirationSecs parameter.] Keywords: measure eye movements. 9 August 2002.

MEX & DLL files


PSIGNIFITJeremy Hill and Felix Wichmann

Maximum-likelihood fitting and significance testing software for psychometric functions. PSIGNIFIT is a multi-platform software tool for fitting sigmoidal psychometric functions to psychophysical data, taking into account possible "nuisance" parameters such as the observer's lapse rate, assessing goodness-of-fit by Monte-Carlo simulation, and providing confidence intervals via bootstrap methods.

OpenGL — Ben Singer

SimpleGL is a Matlab extension file (for Mac) to use OpenGL.

Page flipping and double buffering — Ben Singer

A MEX function to do page flipping on some displays. See Ben's page-flipping page. Our questions page explains page flipping and how it's used to do double buffering to avoid the "tear" artifact.

Moving random dots — Mike Shadlen and colleagues

A MEX function that displays random dots in motion. Download. 20 June, 2001.

Anti-aliased line drawing — Leola Reese

A MEX function for drawing thin high-contrast grayscale anti-aliased lines. warn Worked with Psychtoolbox version 2.1, but would need to be recompiled to be compatible with the current Psychtoolbox. Download. 26 August 1997.

Use CMU button box — Brian Stankiewicz

A MEX function that talks to the CMU button box. See Brian's MEX page. [On 6/18/02, Brian wrote, "The CMU BBox bbox software needs updating and I just don't have the time right now to do it. (It was originally developed using Think C and I am not a Metroworks guru yet.) ... The main problem is that the program only looks at the printer port for the CMU bbox. The -serial converter and PsychSERIAL work fine with the bbox, but my code cannot access the bbox that way right now. I would be happy to provide and supply whatever is necessary to do this updating."]

For recent information the CMU button box mex file see this forum message and others in the same thread.

Create linear lookup tables — Brian Stankiewicz

A MEX function that reads a LuminanceRecord created by Denis Pelli's CalibrateLuminance program (in the demos folder of the VideoToolbox) and creates a lookup table to linearize the monitor's gamma. See Brian's MEX page.

Matced is a CED-1401 Matlab interface - Dario Ringach

An interface allowing Matlab to directly control the CED-1401 data acquisition system.

KeMo source code, in C, for measuring keyboard reaction time - Dan Costin

See our KeMo page.

Use Eyelink© gazetracker - Frans Cornellisen and Enno Peters.

See the Eyelink Toolbox page. 22 June, 2001.

matlabPyrTools - Eero Simoncelli

Matlab source code for multi-scale image processing. Includes tools for building and manipulating Laplacian pyramids, QMF/Wavelets, and steerable pyramids.

Filetype extensions - Erik Johnson

Get and change file type and creator of a Mac file.


Psychtoolbox with Siemens MRI scanner - Russell Poldrack

Russell reports success using the Psychtoolbox with a Siemens scanner and the Rowland Response Box to collect subject responses in the scanner.

VVRC IFIS-Psychtoolbox Interface for fMRI - Allen Ingling

Software for synchronizing stimuli with MRI scans and collecting subject responses using prototype hardware from PST and a National Instruments digital I/O card. The software is configured for use specifically with hardware at the VVRC site and is not directly portable, but it could be adapted for use at other sites. The interface is currently maintained by Dan Shima.

Synchronizing stimulus presentation with an MRI scanner - Michael S. Beauchamp

MovStim reads in the name of stimuli from an ASCII text file and then presents them to the subject synchronized with the MR Scanner; the exact start and stop times of each clip are saved to a text file, and an output pulse is generated at each stimulus onset as an additional check on timing. Requires the Psychtoolbox and other support files, including files adapted from the VVRC IFIS-Psychtoolbox interface.



PsychPy: Psychology Software for Python - Jon Peirce

An open-source package for creating psychology stimuli in Python, it combines the graphical strengths of OpenGL with the easy Python syntax to give psychophysics a free and simple stimulus presentation and control package.

VisionEgg - Andrew Straw

An open and free programming environment for generating visual stimuli for Psychophysics. Based on the Open Source scripting language Python and using PyGame, a Python binding to SDL and OpenGL.


Octave is a free numerical programming environment distributed under the GNU General Public License and compatible with Matlab 4 syntax. (Structs and cell arrays were added in MATLAB 5). Available for Linux, Windows and OS X. The OS X version can be installed using the Fink package manager.

Cogent 2000 - John Romaya, Oliver Josephs, Tomas Franzon and others

Like the Psychtoolbox, a set of Matlab extensions for presenting visual stimuli. Based on DirectX.

RSVP for Mac OS - Pepper Williams, Michael J. Tarr, Steve Finney and Timothy Bates

A simple scripting language for presenting canned stimuli stored as PICT, sound resource, or QuickTime files and collecting and recording subject responses.

MatVis and WinVis - Neurometrics Institute

Commercial software for designing vision and neuroscience experiments using Matlab.

Within-subject ANOVA graphical user interface(GUI) - Erin Harley

Analyzes a single or double-factor design and returns an ANOVA table, a means table and standard
error. MATLAB's Statistics Toolbox is NOT needed to run the GUI.


visitors since 25 May 2002.

David Brainard, Denis Pelli & Allen Ingling.

9 August 2002