goxpyriment is a high-level Go framework for building behavioral and psychological experiments.
Just want to run demo experiments? → Jump to Demos.
Want to write your own experiment? Goxpyriment is well suited to “vibe-coding” psychology experiments — but humans enjoy coding with it too:
git clone https://github.com/chrplr/goxpyriment.git or download ZIP).goxpyriment folder and ask it to review the provided examples; then prompt it to program your experiment, describing it in plain language (stimuli, design, etc.).my_experiment/, test it by running go run my_experiment/main.go in the terminal.Goxpyriment relies on the libsdl library through the go-sdl3 bindings. Its API is largely inspired by expyriment.org:
Krause, F., & Lindemann, O. (2014). Expyriment: A Python library for cognitive and neuroscientific experiments. Behavior Research Methods, 46(2), 416–428. https://doi.org/10.3758/s13428-013-0390-6
See also gostim2 for a simpler, no-code experiment generator.
Christophe Pallier, March 2026
.gv (LZ4-compressed RGBA) sequences, both VSYNC-locked..xpd files (CSV with metadata header) with automatic subject ID, timestamp, and display-info fields.Wait() / WaitUntil(), VSYNC-locked frame cadence via SDL3.You can download here ready-to-run examples of experiments created with goxpyriment (and check their source code if you want).
goxpyriment-examples-windows-x86_64-setup.exe. Execute it; Defender may block you: click “more info” then “Run anyway”. By default, experiments are installed in AppData\Local\Goxpyriment examples\bin in your user folder. As AppData is a hidden folder, select View > Show > Hidden items in File Explorer to navigate there.macOS: Download goxpyriment-examples-macos-arm64-app.zip, extract it, and drag the .app files into a folder of your choice (e.g. Applications/goxpyriment-examples).
[!WARNING] macOS may show a security warning the first time you open each app. See macOS installation and security for an explanation and step-by-step instructions to bypass it.
goxpyriment-examples-linux-x86_64-appimages.tar.gz and untar it (tar xzf). The applications are ready to run.Download and install Go from https://go.dev. While Python is easy, Go is simple, which is a good thing.
go get github.com/chrplr/goxpyriment
Here is the code of a minimal “Hello World” experiment (the full version with audio is at examples/hello_world/main.go):
package main
import (
"github.com/chrplr/goxpyriment/control"
"github.com/chrplr/goxpyriment/stimuli"
)
func main() {
exp := control.NewExperimentFromFlags("Hello World", control.Black, control.White, 32)
defer exp.End()
instr := stimuli.NewTextBox("Press any key to start.", 600, control.FPoint{X: 0, Y: 0}, control.DefaultTextColor)
hello := stimuli.NewTextBox("Hello World!", 600, control.FPoint{X: 0, Y: 0}, control.DefaultTextColor)
finish := stimuli.NewTextBox("Done — press any key to exit.", 600, control.FPoint{X: 0, Y: 0}, control.DefaultTextColor)
exp.Show(instr)
exp.Keyboard.Wait()
exp.Show(hello)
exp.Keyboard.Wait()
exp.Show(finish)
exp.Keyboard.Wait()
}
Run or build examples from within this repository:
cd examples/hello_world
go run . # fullscreen by default
go run . -d # windowed 1024×1024 (developer mode)
go run . -d -s 1 # windowed, subject ID = 1
go build . # build a standalone binary
Run any example directly from the repository root:
go run ./examples/parity_decision/ -d -s 1
Most examples accept -d (windowed 1024×1024 developer mode) and -s <id> (subject ID written to the .xpd data file).
To build all examples at once:
cd examples
./build.sh
Cross-compiling is straightforward in Go — you can build binaries for Windows, macOS, and Linux (Intel or ARM) from any machine.
control/: Experiment lifecycle and state management (window, fonts, colors).design/: Tools for building the experimental structure (Trials, Blocks).stimuli/: A comprehensive library of visual and auditory stimuli.io/: Screen, Keyboard, and Mouse handling.clock/: Timing utilities.geometry/: Geometry utilities.examples/: Ready-to-run examples (Stroop task, Lexical Decision, etc.).This project is licensed under the GNU Public License v3 - see the LICENSE file for details.
Christophe Pallier, 2026
![]()