# Programming Help

**URL:** https://psychtoolbox.discourse.group/c/for-problems-with-your-ptb-code/8.md

[Latest](https://psychtoolbox.discourse.group/latest.md) · [Categories](https://psychtoolbox.discourse.group/categories.md) · [Tags](https://psychtoolbox.discourse.group/tags.md)

---

## [Psychtoolbox Demos / Tutorials](https://psychtoolbox.discourse.group/t/psychtoolbox-demos-tutorials/4012)

<div class="topic-metadata">

**Author:** [@pscarfe](https://psychtoolbox.discourse.group/u/pscarfe)\
**Replies:** 36\
**Last updated:** [August 6, 2025, 2:42am UTC](https://psychtoolbox.discourse.group/t/psychtoolbox-demos-tutorials/4012 "2025-08-06T02:42:18Z")

</div>

Hi all. A while back I wrote a bunch of demos for PTB. These seemed to prove useful to folk, but thanks to Adobe I was for a long time not able to update my website. I also got a lectureship, so my time for doing coding…

---

## [About the Programming Help category](https://psychtoolbox.discourse.group/t/about-the-programming-help-category/3055)

<div class="topic-metadata">

**Author:** [@Ian-Max-Andolina](https://psychtoolbox.discourse.group/u/Ian-Max-Andolina)\
**Replies:** 0\
**Last updated:** [February 17, 2020, 1:59pm UTC](https://psychtoolbox.discourse.group/t/about-the-programming-help-category/3055 "2020-02-17T13:59:29Z")

</div>

Please make sure you read this post before asking for help. No one can help you unless you provide a clear description of the software environment you are using and your programming problem…

---

## [License activation](https://psychtoolbox.discourse.group/t/license-activation/5809)

<div class="topic-metadata">

**Author:** [@BlueStickyNote](https://psychtoolbox.discourse.group/u/BlueStickyNote)\
**Replies:** 1\
**Last updated:** [July 13, 2026, 9:15pm UTC](https://psychtoolbox.discourse.group/t/license-activation/5809 "2026-07-13T21:15:47Z")

</div>

Hi, I have a license key from August 2025. I have received a new laptop and installed the Psychtoolbox version 3.0.22. How do I activate the toolbox with the license key ? Authentication token : 67778-IL-202671013364:b…

---

## [Invalid MEX-file error on MATLAB](https://psychtoolbox.discourse.group/t/invalid-mex-file-error-on-matlab/5797)

<div class="topic-metadata">

**Author:** [@Ghu](https://psychtoolbox.discourse.group/u/Ghu)\
**Replies:** 1\
**Last updated:** [April 3, 2026, 6:18pm UTC](https://psychtoolbox.discourse.group/t/invalid-mex-file-error-on-matlab/5797 "2026-04-03T18:18:26Z")

</div>

Hello, I am programming with MATLABR2023a for academic use and have encountered this error message several times: Invalid MEX-file ‘C:\\Psychtoolbox\\PsychBasic\\MatlabWindowsFilesR2007a\\Eyelink.mexw64’: The network path w…

---

## [KbQueueCheck Documentation](https://psychtoolbox.discourse.group/t/kbqueuecheck-documentation/5803)

<div class="topic-metadata">

**Author:** [@pscarfe](https://psychtoolbox.discourse.group/u/pscarfe)\
**Replies:** 7\
**Last updated:** [March 18, 2026, 6:12pm UTC](https://psychtoolbox.discourse.group/t/kbqueuecheck-documentation/5803 "2026-03-18T18:12:48Z")

</div>

I am sure this is just being dumb. I have been working all weekend on admin which has rotted my brain. The documentation for KbQueueCheck states “Obtains data about keypresses on the specified device since the most rec…

---

## [Code check: Unusual reaction times (like less than 100 ms) for an AX-CPT task coded using PTB version 3.0.19](https://psychtoolbox.discourse.group/t/code-check-unusual-reaction-times-like-less-than-100-ms-for-an-ax-cpt-task-coded-using-ptb-version-3-0-19/5798)

<div class="topic-metadata">

**Author:** [@tylerdurden9591](https://psychtoolbox.discourse.group/u/tylerdurden9591)\
**Replies:** 1\
**Last updated:** [March 13, 2026, 8:09am UTC](https://psychtoolbox.discourse.group/t/code-check-unusual-reaction-times-like-less-than-100-ms-for-an-ax-cpt-task-coded-using-ptb-version-3-0-19/5798 "2026-03-13T08:09:26Z")

</div>

I am coding an AX-CPT task using PTB in MATLAB and while doing pilot testing, I am getting unusual RTs (Less than 100ms) when the participant is trying to do the task fast. Below are the details of the environment I am u…

---

## [First stimulus in Psychtoolbox trial consistently ~30 ms shorter than expected when chaining flips with vbl](https://psychtoolbox.discourse.group/t/first-stimulus-in-psychtoolbox-trial-consistently-30-ms-shorter-than-expected-when-chaining-flips-with-vbl/5786)

<div class="topic-metadata">

**Author:** [@YA87](https://psychtoolbox.discourse.group/u/YA87)\
**Replies:** 4\
**Last updated:** [February 15, 2026, 8:59pm UTC](https://psychtoolbox.discourse.group/t/first-stimulus-in-psychtoolbox-trial-consistently-30-ms-shorter-than-expected-when-chaining-flips-with-vbl/5786 "2026-02-15T20:59:57Z")

</div>

Hi everyone, I’m experiencing a consistent timing issue in my Psychtoolbox experiment. The very first stimulus in each trial (e.g., the fixation cross or the feedback after response window) is always about ~30 ms shorte…

---

## [GStreamer x Windows 11 issue](https://psychtoolbox.discourse.group/t/gstreamer-x-windows-11-issue/5782)

<div class="topic-metadata">

**Author:** [@ChildLabsAU](https://psychtoolbox.discourse.group/u/ChildLabsAU)\
**Replies:** 3\
**Last updated:** [January 28, 2026, 8:03pm UTC](https://psychtoolbox.discourse.group/t/gstreamer-x-windows-11-issue/5782 "2026-01-28T20:03:55Z")

</div>

support key: 0199aa85-0b7c-7d82-9ec1-6b585dd136b3 OS: Windows 11 (Acer PC) Matlab: R2024b PTB: latest stable (3.0.22.1) GStreamer: latest stable (1.26.10), “complete” install Hi, We’ve just had to update our OS fro…

---

## [Serial trigger to BrainVision TriggerBox stops working after OS upgrade (Windows 11)I](https://psychtoolbox.discourse.group/t/serial-trigger-to-brainvision-triggerbox-stops-working-after-os-upgrade-windows-11-i/5784)

<div class="topic-metadata">

**Author:** [@sg1021](https://psychtoolbox.discourse.group/u/sg1021)\
**Replies:** 5\
**Last updated:** [January 27, 2026, 4:07pm UTC](https://psychtoolbox.discourse.group/t/serial-trigger-to-brainvision-triggerbox-stops-working-after-os-upgrade-windows-11-i/5784 "2026-01-27T16:07:15Z")

</div>

Dear Community, Current environment: Windows 11 Psychtoolbox-3 (3.0.22.1) MATLAB R2025b Previous environment: Windows 10 Psychtoolbox-3 (3.0.19.3) MATLAB R2023 We run an EEG experiment using Brai…

---

## [I am recieving a value of 10 for the screen number when I only have 2 screens](https://psychtoolbox.discourse.group/t/i-am-recieving-a-value-of-10-for-the-screen-number-when-i-only-have-2-screens/5776)

<div class="topic-metadata">

**Author:** [@malmberg](https://psychtoolbox.discourse.group/u/malmberg)\
**Replies:** 1\
**Last updated:** [December 12, 2025, 6:53pm UTC](https://psychtoolbox.discourse.group/t/i-am-recieving-a-value-of-10-for-the-screen-number-when-i-only-have-2-screens/5776 "2025-12-12T18:53:54Z")

</div>

=== delete this after reading === Please make sure you read this post before asking for help. No one can help you unless you provide a clear description of the software environment you are using and your programming pro…

---

## [Joystick driver](https://psychtoolbox.discourse.group/t/joystick-driver/5237)

<div class="topic-metadata">

**Author:** [@gopie](https://psychtoolbox.discourse.group/u/gopie)\
**Replies:** 3\
**Last updated:** [October 27, 2025, 5:30am UTC](https://psychtoolbox.discourse.group/t/joystick-driver/5237 "2025-10-27T05:30:15Z")

</div>

Hi All, I’m attempting to install the joystick driver on a 22.04 version of linux that has the hwe installed. However, running the command provided in the instructions (sudo apt install xserver-xorg-input-joystick-hwe-2…

---

## [Specify a movie fps different from what is in .mov file](https://psychtoolbox.discourse.group/t/specify-a-movie-fps-different-from-what-is-in-mov-file/5761)

<div class="topic-metadata">

**Author:** [@saumil](https://psychtoolbox.discourse.group/u/saumil)\
**Replies:** 1\
**Last updated:** [September 29, 2025, 11:45pm UTC](https://psychtoolbox.discourse.group/t/specify-a-movie-fps-different-from-what-is-in-mov-file/5761 "2025-09-29T23:45:16Z")

</div>

Hi, We are trying to play a series of movies with different fps (e.g. about 24, 25, 30, 60; fps are not exact and have decimal digits, e.g. 29.037) continuously. We are using Psychtoolbox-3 on Linux machine with a Nvidia…

---

## [Trigger generation issue](https://psychtoolbox.discourse.group/t/trigger-generation-issue/5491)

<div class="topic-metadata">

**Author:** [@bono.kat](https://psychtoolbox.discourse.group/u/bono.kat)\
**Replies:** 2\
**Last updated:** [August 6, 2025, 2:04am UTC](https://psychtoolbox.discourse.group/t/trigger-generation-issue/5491 "2025-08-06T02:04:49Z")

</div>

Dear Community, Info: Psychtoolbox-3 (3.0.19) MATLAB platform (2021b) ubuntu (22.04) I have a very broad question. I am running my experiment and pass the triggers on EEG. However, sometimes random triggers are miss…

---

## [First time using eyelink and psycho toolbox](https://psychtoolbox.discourse.group/t/first-time-using-eyelink-and-psycho-toolbox/5743)

<div class="topic-metadata">

**Author:** [@scientist](https://psychtoolbox.discourse.group/u/scientist)\
**Replies:** 2\
**Last updated:** [July 31, 2025, 10:07pm UTC](https://psychtoolbox.discourse.group/t/first-time-using-eyelink-and-psycho-toolbox/5743 "2025-07-31T22:07:28Z")

</div>

Hi, A newbie to eyelink here. I’m trying to do pupillometry simultaneously with a resting-state scan. I’m attaching my Matlab script that I’m trying to use to start eyelink to record below. But it’s unclear to me what …

---

## [Gabor generation](https://psychtoolbox.discourse.group/t/gabor-generation/5724)

<div class="topic-metadata">

**Author:** [@blob](https://psychtoolbox.discourse.group/u/blob)\
**Replies:** 1\
**Last updated:** [June 18, 2025, 2:22pm UTC](https://psychtoolbox.discourse.group/t/gabor-generation/5724 "2025-06-18T14:22:47Z")

</div>

what did he mean when he says in the commentars that it could be written in a nicer way? what is wrong with this actual verison? if 1 % Definition of a Gabor patch as Matlab grayscale matrix 'm' with % proper si…

---

## ["Invalid movie handle provided" error message](https://psychtoolbox.discourse.group/t/invalid-movie-handle-provided-error-message/5719)

<div class="topic-metadata">

**Author:** [@inichoson](https://psychtoolbox.discourse.group/u/inichoson)\
**Replies:** 2\
**Last updated:** [June 12, 2025, 11:55pm UTC](https://psychtoolbox.discourse.group/t/invalid-movie-handle-provided-error-message/5719 "2025-06-12T23:55:05Z")

</div>

I have a script that just plays videos back to back based off of the “Play Movies Without Gaps” script in PTB’s Movie Demos. I am having a weird issue though where the script consistently picks one movie iteration to qui…

---

## [How to use OBS to screen record a third monitor in a multi-display setup on Linux/Ubuntu?](https://psychtoolbox.discourse.group/t/how-to-use-obs-to-screen-record-a-third-monitor-in-a-multi-display-setup-on-linux-ubuntu/5721)

<div class="topic-metadata">

**Author:** [@autopoiesis](https://psychtoolbox.discourse.group/u/autopoiesis)\
**Replies:** 2\
**Last updated:** [June 8, 2025, 11:35am UTC](https://psychtoolbox.discourse.group/t/how-to-use-obs-to-screen-record-a-third-monitor-in-a-multi-display-setup-on-linux-ubuntu/5721 "2025-06-08T11:35:29Z")

</div>

I need to run OBS to screen record one of three monitors (the primary stimulus presentation monitor). However, after configuring the screens via XOrgConf in Matlab, the two additional monitors are now blacked out (with a…

---

## [Absolute scaling of texture values for HDR (BT2100) videos](https://psychtoolbox.discourse.group/t/absolute-scaling-of-texture-values-for-hdr-bt2100-videos/5722)

<div class="topic-metadata">

**Author:** [@mantiuk](https://psychtoolbox.discourse.group/u/mantiuk)\
**Replies:** 2\
**Last updated:** [June 6, 2025, 2:17pm UTC](https://psychtoolbox.discourse.group/t/absolute-scaling-of-texture-values-for-hdr-bt2100-videos/5722 "2025-06-06T14:17:56Z")

</div>

When reading frames from HDR video files (BT2100), the values in the textures seem to be in linear RGB BT.2020 colorspace, but absolute scaling of those values differs depending on how the corresponding Psychtoolbox wind…

---

## [Failed to choose the 12-bit precision window on AMD graphics card](https://psychtoolbox.discourse.group/t/failed-to-choose-the-12-bit-precision-window-on-amd-graphics-card/5699)

<div class="topic-metadata">

**Author:** [@ziyuan](https://psychtoolbox.discourse.group/u/ziyuan)\
**Replies:** 20\
**Last updated:** [May 28, 2025, 3:57pm UTC](https://psychtoolbox.discourse.group/t/failed-to-choose-the-12-bit-precision-window-on-amd-graphics-card/5699 "2025-05-28T15:57:13Z")

</div>

hi community and team, I encountered problems while setting up Psychtoolbox to achieve a precision of 12 bits. My configuration is as follows: OS: Ubuntu 22.04.5 LTS; GPU: AMD® Radeon pro w7600; Matlab: R2024b; I in…

---

## [Specify start and end time during multiple movie playback](https://psychtoolbox.discourse.group/t/specify-start-and-end-time-during-multiple-movie-playback/5687)

<div class="topic-metadata">

**Author:** [@saumil](https://psychtoolbox.discourse.group/u/saumil)\
**Replies:** 3\
**Last updated:** [May 25, 2025, 7:47pm UTC](https://psychtoolbox.discourse.group/t/specify-start-and-end-time-during-multiple-movie-playback/5687 "2025-05-25T19:47:16Z")

</div>

Hi, We have been playing multiple movies sequentially without a break by using async flag 4 for first movie and then 6 for all subsequent movies. And this is working very well. Now we want to specify a start and end fra…

---

## [Inquiry Regarding PsychPortAudio('Stop') Function](https://psychtoolbox.discourse.group/t/inquiry-regarding-psychportaudio-stop-function/5689)

<div class="topic-metadata">

**Author:** [@yangzhangpsy](https://psychtoolbox.discourse.group/u/yangzhangpsy)\
**Replies:** 1\
**Last updated:** [April 15, 2025, 7:33pm UTC](https://psychtoolbox.discourse.group/t/inquiry-regarding-psychportaudio-stop-function/5689 "2025-04-15T19:33:54Z")

</div>

Dear Mario Kleiner, I have a quick question regarding the PsychPortAudio('Stop') function. According to the help documentation, this function is supposed to return four output parameters: \[audioStartTimeEnd, endPosition…

---

## [Setting up Psychtoolbox on Linux (Debian)- two screens](https://psychtoolbox.discourse.group/t/setting-up-psychtoolbox-on-linux-debian-two-screens/5545)

<div class="topic-metadata">

**Author:** [@Reuben](https://psychtoolbox.discourse.group/u/Reuben)\
**Replies:** 1\
**Last updated:** [April 10, 2025, 2:16am UTC](https://psychtoolbox.discourse.group/t/setting-up-psychtoolbox-on-linux-debian-two-screens/5545 "2025-04-10T02:16:19Z")

</div>

I thought I would include the guide I wrote after setting up Psychtoolbox on Linux in our lab. I am by no means an expert, but this procedure worked well for me so I thought it may be useful to others. Two-screen Linux …

---

## [LabJack on linux to read in inputs/triggers for screen flips in matlab](https://psychtoolbox.discourse.group/t/labjack-on-linux-to-read-in-inputs-triggers-for-screen-flips-in-matlab/5650)

<div class="topic-metadata">

**Author:** [@adeeti](https://psychtoolbox.discourse.group/u/adeeti)\
**Replies:** 6\
**Last updated:** [April 7, 2025, 7:42pm UTC](https://psychtoolbox.discourse.group/t/labjack-on-linux-to-read-in-inputs-triggers-for-screen-flips-in-matlab/5650 "2025-04-07T19:42:20Z")

</div>

Hi PTB community! I have a PTB3 installed on my ubuntu 22.04 laptop and have been using a labjack U3 for quite reliable TTL outputs for screen flips using the linux exodriver and following function: I would also like…

---

## [Unable to install psychtoolbox (beginner)](https://psychtoolbox.discourse.group/t/unable-to-install-psychtoolbox-beginner/5672)

<div class="topic-metadata">

**Author:** [@KogakuGura](https://psychtoolbox.discourse.group/u/KogakuGura)\
**Replies:** 2\
**Last updated:** [April 5, 2025, 5:09am UTC](https://psychtoolbox.discourse.group/t/unable-to-install-psychtoolbox-beginner/5672 "2025-04-05T05:09:05Z")

</div>

I apologize if this is rude as my native language is not English. I am trying to use Psychtoolbox for the first time and have installed it while looking at the Psychtoolbox website, but it is not working. I would like t…

---

## [Unable to display image on external monitor AMD laptop](https://psychtoolbox.discourse.group/t/unable-to-display-image-on-external-monitor-amd-laptop/5486)

<div class="topic-metadata">

**Author:** [@adeeti](https://psychtoolbox.discourse.group/u/adeeti)\
**Replies:** 8\
**Last updated:** [April 1, 2025, 5:59pm UTC](https://psychtoolbox.discourse.group/t/unable-to-display-image-on-external-monitor-amd-laptop/5486 "2025-04-01T17:59:59Z")

</div>

Authentication token: ANY4B-UP-2024827113311:2b28a796aa78935b57eba267c343dc7e405314cf628162f42acbd1aed89a1752 Hi PTB community and team, I am trying to set up psychtoolbox to display visual stimuli to mice for electroph…

---

## [Psychtoolbox Issue After macOS Sequoia 15.3.1 Update](https://psychtoolbox.discourse.group/t/psychtoolbox-issue-after-macos-sequoia-15-3-1-update/5665)

<div class="topic-metadata">

**Author:** [@dilanazn](https://psychtoolbox.discourse.group/u/dilanazn)\
**Replies:** 4\
**Last updated:** [March 13, 2025, 3:26pm UTC](https://psychtoolbox.discourse.group/t/psychtoolbox-issue-after-macos-sequoia-15-3-1-update/5665 "2025-03-13T15:26:33Z")

</div>

Hello Psychtoolbox community, I’m encountering issues with my Psychtoolbox code after updating my macOS to Sequoia 15.3.1. The code, which is quite extensive, was functioning correctly before the update. Now, it’s faili…

---

## [Play many movies back-to-back without significant gap between them](https://psychtoolbox.discourse.group/t/play-many-movies-back-to-back-without-significant-gap-between-them/5642)

<div class="topic-metadata">

**Author:** [@saumil](https://psychtoolbox.discourse.group/u/saumil)\
**Replies:** 9\
**Last updated:** [February 24, 2025, 3:45pm UTC](https://psychtoolbox.discourse.group/t/play-many-movies-back-to-back-without-significant-gap-between-them/5642 "2025-02-24T15:45:17Z")

</div>

Hi, We are using Psychtoolbox on Linux in Matlab 2024. We want to play a sequence of videos (there may be over 1000 videos) without any noticeable break between the videos. Each video has 1920x1080 pixels frames and wil…

---

## [Psychportaudio: play 3 audio through 3 MOTU speakers all at the same time](https://psychtoolbox.discourse.group/t/psychportaudio-play-3-audio-through-3-motu-speakers-all-at-the-same-time/5649)

<div class="topic-metadata">

**Author:** [@fasumed](https://psychtoolbox.discourse.group/u/fasumed)\
**Replies:** 0\
**Last updated:** [February 21, 2025, 7:29pm UTC](https://psychtoolbox.discourse.group/t/psychportaudio-play-3-audio-through-3-motu-speakers-all-at-the-same-time/5649 "2025-02-21T19:29:59Z")

</div>

I need to play 3 sound files through 3 spatially located loudspeakers(front, left, right) all at the same time. We have a MOTU sound system connected to the 3 loudspeakers, however, psychportaudio shows 2 available chan…

---

## [Interference when using two mice](https://psychtoolbox.discourse.group/t/interference-when-using-two-mice/5638)

<div class="topic-metadata">

**Author:** [@CSchranz](https://psychtoolbox.discourse.group/u/CSchranz)\
**Replies:** 4\
**Last updated:** [February 7, 2025, 11:07am UTC](https://psychtoolbox.discourse.group/t/interference-when-using-two-mice/5638 "2025-02-07T11:07:17Z")

</div>

Hello, I am trying two read the input of two mice from two screen in Ubuntu 20.4 in Matlab 2024a with Psychtoolbox 3.0.19.14. I am using this to let two participants that each have a mouse and a screen to rate and expe…

---

## [Unable to install on Apple Silicon Macs through Matlab Add-on](https://psychtoolbox.discourse.group/t/unable-to-install-on-apple-silicon-macs-through-matlab-add-on/5592)

<div class="topic-metadata">

**Author:** [@Suubaozi](https://psychtoolbox.discourse.group/u/Suubaozi)\
**Replies:** 16\
**Last updated:** [January 28, 2025, 9:09pm UTC](https://psychtoolbox.discourse.group/t/unable-to-install-on-apple-silicon-macs-through-matlab-add-on/5592 "2025-01-28T21:09:41Z")

</div>

It’s my first time to download PTB. I’m using Apple M2 (Sonoma 14.0) and Matlab2024b (Silicon/ARM version). I installed Gstreamer 1.24.10 runtime installer. After watching Celia’s video, I downloaded and installed PTB…

[Next page](https://psychtoolbox.discourse.group/c/for-problems-with-your-ptb-code/8.md?page=1)
