# Programming Help

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

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

**Page:** 3

---

## [Script is running, but no sounds are played](https://psychtoolbox.discourse.group/t/script-is-running-but-no-sounds-are-played/4997)

<div class="topic-metadata">

**Author:** [@Ellen](https://psychtoolbox.discourse.group/u/Ellen)\
**Replies:** 4\
**Last updated:** [August 19, 2024, 1:50pm UTC](https://psychtoolbox.discourse.group/t/script-is-running-but-no-sounds-are-played/4997 "2024-08-19T13:50:49Z")

</div>

Hi, I am setting up my audio-visual experiment. My code, which has video and audio, worked perfectly fine on my screen and computer (it is a PRIME B560M-A with Windows 11 version 22H2, 64-bit operating system and 11th G…

---

## [Inconsistent Clock Behavior on Laptop](https://psychtoolbox.discourse.group/t/inconsistent-clock-behavior-on-laptop/5291)

<div class="topic-metadata">

**Author:** [@asali](https://psychtoolbox.discourse.group/u/asali)\
**Replies:** 7\
**Last updated:** [August 13, 2024, 4:31pm UTC](https://psychtoolbox.discourse.group/t/inconsistent-clock-behavior-on-laptop/5291 "2024-08-13T16:31:33Z")

</div>

Hello, I tried to post yesterday but it got flagged as spam. Sorry for another post (please disregard that one if it is still in your queue). We’ve noticed a rare defect in our stimulus onset times that are recorded in…

---

## [Inconsistent/Random Kb Errors?](https://psychtoolbox.discourse.group/t/inconsistent-random-kb-errors/5409)

<div class="topic-metadata">

**Author:** [@Jomalo99](https://psychtoolbox.discourse.group/u/Jomalo99)\
**Replies:** 3\
**Last updated:** [July 22, 2024, 8:29pm UTC](https://psychtoolbox.discourse.group/t/inconsistent-random-kb-errors/5409 "2024-07-22T20:29:07Z")

</div>

Hi everyone, I’m a research assistant, and I’m fairly new to coding, so I apologize if this question has a more straightforward answer that I am not understanding. The problem is primarily one of inconsistency. I have …

---

## [Words are not horizontally aligned in word-by-word display](https://psychtoolbox.discourse.group/t/words-are-not-horizontally-aligned-in-word-by-word-display/5424)

<div class="topic-metadata">

**Author:** [@zrhuang](https://psychtoolbox.discourse.group/u/zrhuang)\
**Replies:** 1\
**Last updated:** [July 17, 2024, 6:03pm UTC](https://psychtoolbox.discourse.group/t/words-are-not-horizontally-aligned-in-word-by-word-display/5424 "2024-07-17T18:03:07Z")

</div>

Hi everyone! I am trying to present the words in sentences word-by word at the centre of the screen. it works well but I noticed that the centred words are not horizontally aligned because the text bounds are different …

---

## [Psychtoolbox 32 bit 3.0.11](https://psychtoolbox.discourse.group/t/psychtoolbox-32-bit-3-0-11/5396)

<div class="topic-metadata">

**Author:** [@Eva](https://psychtoolbox.discourse.group/u/Eva)\
**Replies:** 5\
**Last updated:** [July 3, 2024, 10:21am UTC](https://psychtoolbox.discourse.group/t/psychtoolbox-32-bit-3-0-11/5396 "2024-07-03T10:21:09Z")

</div>

Hello, I’m trying to locate an older version of the Psychtoolbox,(32 bit flavour 3.0.11) for windows 7 and matlab 2012a but i don’t seem to be able to find it. Several posts point to: http://psychtoolbox.org/download/#…

---

## [Detect overlap of rectangle and moving and rotating texture](https://psychtoolbox.discourse.group/t/detect-overlap-of-rectangle-and-moving-and-rotating-texture/5402)

<div class="topic-metadata">

**Author:** [@mg98902](https://psychtoolbox.discourse.group/u/mg98902)\
**Replies:** 6\
**Last updated:** [June 28, 2024, 6:04pm UTC](https://psychtoolbox.discourse.group/t/detect-overlap-of-rectangle-and-moving-and-rotating-texture/5402 "2024-06-28T18:04:22Z")

</div>

Hi all, I want to detect whether a moving rectangle is inside another static rectangular area or not. The moving rectangle is a texture displayed with Screen(‘DrawTexture’,…) and it also rotates. The static rectangle i…

---

## [How to create bullseye stimuli in PTB?](https://psychtoolbox.discourse.group/t/how-to-create-bullseye-stimuli-in-ptb/3915)

<div class="topic-metadata">

**Author:** [@Jiangang](https://psychtoolbox.discourse.group/u/Jiangang)\
**Replies:** 6\
**Last updated:** [June 28, 2024, 12:43am UTC](https://psychtoolbox.discourse.group/t/how-to-create-bullseye-stimuli-in-ptb/3915 "2024-06-28T00:43:54Z")

</div>

Hi all! This is Jiangang. I’m trying to use bullseye stimuli (sine-wave concentric circles with parameters like contrast and spatial frequency, similar to gratings) in my experiment. Just like what is shown in fig. 1 of…

---

## [The parPulse function cannot work in the NeuroScan Curry 9 system](https://psychtoolbox.discourse.group/t/the-parpulse-function-cannot-work-in-the-neuroscan-curry-9-system/5398)

<div class="topic-metadata">

**Author:** [@HuizhongWu](https://psychtoolbox.discourse.group/u/HuizhongWu)\
**Replies:** 2\
**Last updated:** [June 20, 2024, 9:49am UTC](https://psychtoolbox.discourse.group/t/the-parpulse-function-cannot-work-in-the-neuroscan-curry-9-system/5398 "2024-06-20T09:49:17Z")

</div>

Hi, I used the trigger version of parPulse to send triggers to the NeuroScan Curry 9 system. However, no value was obtained in the event file. Is there something wrong with my code or EEG system? parPulse(hex2dec('378'…

---

## [The 'TextFont' always return 'Arial' in my Octave 7.3](https://psychtoolbox.discourse.group/t/the-textfont-always-return-arial-in-my-octave-7-3/5386)

<div class="topic-metadata">

**Author:** [@HuizhongWu](https://psychtoolbox.discourse.group/u/HuizhongWu)\
**Replies:** 12\
**Last updated:** [June 14, 2024, 3:34pm UTC](https://psychtoolbox.discourse.group/t/the-textfont-always-return-arial-in-my-octave-7-3/5386 "2024-06-14T15:34:18Z")

</div>

Hi, I try to set the textfont into Simple Chinese ‘KaiTi’, which worked in matlab 2023b, but not worked in Octave 7.3. My code is: clear all; \[wptr,wrect\]=Screen('OpenWindow',0,0,\[0,650,640,1080\]); b=Screen('Preference…

---

## [How to send triggers using the parPulse function?](https://psychtoolbox.discourse.group/t/how-to-send-triggers-using-the-parpulse-function/5387)

<div class="topic-metadata">

**Author:** [@HuizhongWu](https://psychtoolbox.discourse.group/u/HuizhongWu)\
**Replies:** 4\
**Last updated:** [June 13, 2024, 9:17am UTC](https://psychtoolbox.discourse.group/t/how-to-send-triggers-using-the-parpulse-function/5387 "2024-06-13T09:17:29Z")

</div>

Hi, I tried my best to understand how to use the parPulse function sending triggers as the official website explained https://display-corner.epfl.ch/index.php?title=ParPulse&oldid=845, but failed. The main issue result …

---

## [Octave 7.3 cannot recognize the io64.mex file and parPluse.mex file](https://psychtoolbox.discourse.group/t/octave-7-3-cannot-recognize-the-io64-mex-file-and-parpluse-mex-file/5377)

<div class="topic-metadata">

**Author:** [@HuizhongWu](https://psychtoolbox.discourse.group/u/HuizhongWu)\
**Replies:** 4\
**Last updated:** [June 11, 2024, 8:58am UTC](https://psychtoolbox.discourse.group/t/octave-7-3-cannot-recognize-the-io64-mex-file-and-parpluse-mex-file/5377 "2024-06-11T08:58:46Z")

</div>

Hi, I am using the PTB 3.0.19.11 in Octave 7.3 on win11, and try to send trigger by io64 function. But Octave cannot find the model of io64.mexw64 file (which worked on Matlab 2023b). Then, I tried the parPulse.mex, but…

---

## [10 second delay with with GST\_STATE\_CHANGE\_ASYNC](https://psychtoolbox.discourse.group/t/10-second-delay-with-with-gst-state-change-async/3924)

<div class="topic-metadata">

**Author:** [@luke\_slip](https://psychtoolbox.discourse.group/u/luke_slip)\
**Replies:** 7\
**Last updated:** [June 10, 2024, 8:39pm UTC](https://psychtoolbox.discourse.group/t/10-second-delay-with-with-gst-state-change-async/3924 "2024-06-10T20:39:39Z")

</div>

Hello, PTB: 3.0.16 - Flavor: - Corresponds to SVN Revision Matlab: 9.7.0.1319299 (R2019b) Update 5 System Details: Memory 5.7 GiB Processor: AMD Ryzen 7 3700u with radeon vega mobile gfx x 8 Graphics: AMD Radeon™ v…

---

## [Help with the download](https://psychtoolbox.discourse.group/t/help-with-the-download/5367)

<div class="topic-metadata">

**Author:** [@chiarafucito](https://psychtoolbox.discourse.group/u/chiarafucito)\
**Replies:** 5\
**Last updated:** [June 2, 2024, 10:56am UTC](https://psychtoolbox.discourse.group/t/help-with-the-download/5367 "2024-06-02T10:56:14Z")

</div>

Hello! I recently started using Matlab for a uni course. My professor asked us to install Psychtoolbox, but I’m using a MacBook Pro (first generation 2012) running on Catalina 10.15.7 I’m using an older Matlab version …

---

## [VBL-Synchronization error\_MacOS\_Monterey](https://psychtoolbox.discourse.group/t/vbl-synchronization-error-macos-monterey/5364)

<div class="topic-metadata">

**Author:** [@kkaur](https://psychtoolbox.discourse.group/u/kkaur)\
**Replies:** 7\
**Last updated:** [May 30, 2024, 6:30pm UTC](https://psychtoolbox.discourse.group/t/vbl-synchronization-error-macos-monterey/5364 "2024-05-30T18:30:49Z")

</div>

authentication token - VZVZT-Y7-2024527132144:027ed7fc331c79118f50803d69b7c41f2e5a4806fdcee5196fce18149b186a6b Hello all, I am trying to run Psychtoolbox on macOS Monterey, my programming platform is MATLAB\_R2021a. Whil…

---

## [Using game engines (Unity,Unreal,etc.) with Psychtoolbox](https://psychtoolbox.discourse.group/t/using-game-engines-unity-unreal-etc-with-psychtoolbox/5357)

<div class="topic-metadata">

**Author:** [@f.sogukpinar](https://psychtoolbox.discourse.group/u/f.sogukpinar)\
**Replies:** 2\
**Last updated:** [May 29, 2024, 5:40pm UTC](https://psychtoolbox.discourse.group/t/using-game-engines-unity-unreal-etc-with-psychtoolbox/5357 "2024-05-29T17:40:32Z")

</div>

Hi all, I wonder if it is possible to easily build games in Psychtoolbox, using game engines like Unity, Unreal, etc. I found out that we could indeed use Unreal with Matlab through Simulink. However, I am not sure if i…

---

## [Install error using SetUpPsychToolBox with Mex files](https://psychtoolbox.discourse.group/t/install-error-using-setuppsychtoolbox-with-mex-files/5351)

<div class="topic-metadata">

**Author:** [@inichoson](https://psychtoolbox.discourse.group/u/inichoson)\
**Replies:** 1\
**Last updated:** [May 16, 2024, 6:22pm UTC](https://psychtoolbox.discourse.group/t/install-error-using-setuppsychtoolbox-with-mex-files/5351 "2024-05-16T18:22:30Z")

</div>

Hello! I’m trying to run PsychTool Box on macOS Sonoma 14, M1 chip, on Matlab 2023b. I was trying to run video stimuli and getting an error saying that my PsychToolBox had not been installed properly. I deleted, download…

---

## [How to get last two decimals of release versions](https://psychtoolbox.discourse.group/t/how-to-get-last-two-decimals-of-release-versions/5335)

<div class="topic-metadata">

**Author:** [@MrRibbits](https://psychtoolbox.discourse.group/u/MrRibbits)\
**Replies:** 4\
**Last updated:** [May 13, 2024, 4:50pm UTC](https://psychtoolbox.discourse.group/t/how-to-get-last-two-decimals-of-release-versions/5335 "2024-05-13T16:50:30Z")

</div>

Is there a way to know the exact version of PTB3 that is installed? The PsychtoolboxVersion command excludes the final two decimals. Not critical, but I just want to make certain the same release is installed across ma…

---

## [Transparent Screen with opaque rectangle](https://psychtoolbox.discourse.group/t/transparent-screen-with-opaque-rectangle/4182)

<div class="topic-metadata">

**Author:** [@kitcat](https://psychtoolbox.discourse.group/u/kitcat)\
**Replies:** 3\
**Last updated:** [May 13, 2024, 4:35pm UTC](https://psychtoolbox.discourse.group/t/transparent-screen-with-opaque-rectangle/4182 "2024-05-13T16:35:35Z")

</div>

Hi, I’m using Matlab in MS Windows to create an experiment. The visual stimulus is pre-made in a web browser and I’m wanting to make the onscreen window in Matlab transparent so that the browser is visible but then have…

---

## [Which one is better for time precision, KDE or gnome](https://psychtoolbox.discourse.group/t/which-one-is-better-for-time-precision-kde-or-gnome/5346)

<div class="topic-metadata">

**Author:** [@AzerilA](https://psychtoolbox.discourse.group/u/AzerilA)\
**Replies:** 1\
**Last updated:** [May 13, 2024, 4:05pm UTC](https://psychtoolbox.discourse.group/t/which-one-is-better-for-time-precision-kde-or-gnome/5346 "2024-05-13T16:05:22Z")

</div>

Hello My stimuli are still images of objects that must be displayed quickly (about 10ms or less). I wanted to know your suggestion about using KDE or Gnome to get more accurate time. specs: ubuntu 22.04(Gnome) Matla…

---

## [KbCheck not identifying number keys when pressed](https://psychtoolbox.discourse.group/t/kbcheck-not-identifying-number-keys-when-pressed/5331)

<div class="topic-metadata">

**Author:** [@Brains](https://psychtoolbox.discourse.group/u/Brains)\
**Replies:** 1\
**Last updated:** [April 18, 2024, 5:10pm UTC](https://psychtoolbox.discourse.group/t/kbcheck-not-identifying-number-keys-when-pressed/5331 "2024-04-18T17:10:59Z")

</div>

Hi - I am using \[keyIsDown, secs, keyCode\] = KbCheck; However, keyCode will not recognize any button press other than the space bar. The keyIsDown variable works fine with all keys, however, the keyCode index will not …

---

## [Screen('DrawTexture') with blurshader seems to do nothing?](https://psychtoolbox.discourse.group/t/screen-drawtexture-with-blurshader-seems-to-do-nothing/5330)

<div class="topic-metadata">

**Author:** [@minjungkim](https://psychtoolbox.discourse.group/u/minjungkim)\
**Replies:** 1\
**Last updated:** [April 17, 2024, 5:46am UTC](https://psychtoolbox.discourse.group/t/screen-drawtexture-with-blurshader-seems-to-do-nothing/5330 "2024-04-17T05:46:35Z")

</div>

I’m interested in writing my own procedural shader and having it attached to a texture that I’d like to draw to the screen. I’ve been reading the help documentation in ProceduralShadingAPI.m and Create2DGaussianBlurShade…

---

## [Concentric Rings / Radial Sine Grating](https://psychtoolbox.discourse.group/t/concentric-rings-radial-sine-grating/5321)

<div class="topic-metadata">

**Author:** [@leonardo](https://psychtoolbox.discourse.group/u/leonardo)\
**Replies:** 6\
**Last updated:** [April 12, 2024, 3:45pm UTC](https://psychtoolbox.discourse.group/t/concentric-rings-radial-sine-grating/5321 "2024-04-12T15:45:30Z")

</div>

Hi all, I’m new to MATLAB and Psychtoolbox. I am currently trying to create concentric rings moving inward (with different contrast) for a task. I’ve seen a specific function with python that creates this (there seems t…

---

## [Gamma correction - missing gray levels](https://psychtoolbox.discourse.group/t/gamma-correction-missing-gray-levels/5313)

<div class="topic-metadata">

**Author:** [@MrAndre89](https://psychtoolbox.discourse.group/u/MrAndre89)\
**Replies:** 1\
**Last updated:** [March 30, 2024, 5:16pm UTC](https://psychtoolbox.discourse.group/t/gamma-correction-missing-gray-levels/5313 "2024-03-30T17:16:16Z")

</div>

Due to the gamma correction, some gray levels are lost. For example, if I gamma encode 255, and then decode, I obtain 255. However, if I gamma encode 254, and then decode, I obtain 255, not 254. Therefore, gray level 2…

---

## [How can I get the start time of the stimulus?](https://psychtoolbox.discourse.group/t/how-can-i-get-the-start-time-of-the-stimulus/5309)

<div class="topic-metadata">

**Author:** [@Ado](https://psychtoolbox.discourse.group/u/Ado)\
**Replies:** 2\
**Last updated:** [March 23, 2024, 6:33am UTC](https://psychtoolbox.discourse.group/t/how-can-i-get-the-start-time-of-the-stimulus/5309 "2024-03-23T06:33:43Z")

</div>

Dear all, I am writing a stimulus program and need to obtain the start time of the stimulus so that I can align it with the system time later. I tested the following code in matlab: startTime = PsychPortAudio( 'Start…

---

## [Cannot Download for M2 Macbook Pro](https://psychtoolbox.discourse.group/t/cannot-download-for-m2-macbook-pro/5298)

<div class="topic-metadata">

**Author:** [@brainz](https://psychtoolbox.discourse.group/u/brainz)\
**Replies:** 4\
**Last updated:** [March 11, 2024, 5:37pm UTC](https://psychtoolbox.discourse.group/t/cannot-download-for-m2-macbook-pro/5298 "2024-03-11T17:37:05Z")

</div>

Hi - I cannot for the life of me download ptb. I get this error when I use ‘SetupPsychtoolbox’ : Error using PsychtoolboxPostInstallRoutine Tried to setup on native Matlab or Octave for Apple Silicon 64-Bit ARM. This i…

---

## [Failed to load PsychPortAudio driver (Macbook Air M2)](https://psychtoolbox.discourse.group/t/failed-to-load-psychportaudio-driver-macbook-air-m2/5300)

<div class="topic-metadata">

**Author:** [@neewbie](https://psychtoolbox.discourse.group/u/neewbie)\
**Replies:** 0\
**Last updated:** [March 11, 2024, 10:07am UTC](https://psychtoolbox.discourse.group/t/failed-to-load-psychportaudio-driver-macbook-air-m2/5300 "2024-03-11T10:07:37Z")

</div>

Hey, I’m a total newbie here trying to run the BasicSoundOutput.demo. It seems like Psychtoolbox has been properly installed, in that PsychtoolboxVersion, help, and demo all work. I’m using the new Macbook air with the M…

---

## [An indescribable problem, seemingly also a hardware issue](https://psychtoolbox.discourse.group/t/an-indescribable-problem-seemingly-also-a-hardware-issue/5285)

<div class="topic-metadata">

**Author:** [@DIALECTIC](https://psychtoolbox.discourse.group/u/DIALECTIC)\
**Replies:** 8\
**Last updated:** [March 10, 2024, 12:28pm UTC](https://psychtoolbox.discourse.group/t/an-indescribable-problem-seemingly-also-a-hardware-issue/5285 "2024-03-10T12:28:26Z")

</div>

I am a college student in China and have encountered a problem that I may not be able to explain. My ‘Screen (Flip)’ function seems to be malfunctioning, and the program displays the following error message after running…

---

## [Parallel Playback of multiple 4K HDR Videos on different displays](https://psychtoolbox.discourse.group/t/parallel-playback-of-multiple-4k-hdr-videos-on-different-displays/5189)

<div class="topic-metadata">

**Author:** [@Dounia](https://psychtoolbox.discourse.group/u/Dounia)\
**Replies:** 5\
**Last updated:** [March 8, 2024, 2:57am UTC](https://psychtoolbox.discourse.group/t/parallel-playback-of-multiple-4k-hdr-videos-on-different-displays/5189 "2024-03-08T02:57:24Z")

</div>

MatLab R2023b, Psychtoolbox 3.0.19, GStreamer 1.22.6, CPU: AMD Ryzen 9 5900X 12-Core processor 3.7GHz, RAM: 32GB, GPU: NVIDIA GeForce RTX 3080, OS: Windows 10 Pro, Displays: two 55” LG OLED G2 (3840x2160). Hello again, …

---

## [The video file saved by VideoRecordingDemo is corrupt](https://psychtoolbox.discourse.group/t/the-video-file-saved-by-videorecordingdemo-is-corrupt/5283)

<div class="topic-metadata">

**Author:** [@SAK](https://psychtoolbox.discourse.group/u/SAK)\
**Replies:** 2\
**Last updated:** [March 4, 2024, 4:27pm UTC](https://psychtoolbox.discourse.group/t/the-video-file-saved-by-videorecordingdemo-is-corrupt/5283 "2024-03-04T16:27:35Z")

</div>

Hi all, I just tried running the VideoRecordingDemo.m with my device (Win 10 system). All seemed fine during recording, but I cannot open the recorded file ‘test.mov’ which was generated by the demo after stopping recor…

---

## [Screen goes black and can't recover](https://psychtoolbox.discourse.group/t/screen-goes-black-and-cant-recover/5275)

<div class="topic-metadata">

**Author:** [@s.lindsay](https://psychtoolbox.discourse.group/u/s.lindsay)\
**Replies:** 2\
**Last updated:** [February 29, 2024, 4:27pm UTC](https://psychtoolbox.discourse.group/t/screen-goes-black-and-cant-recover/5275 "2024-02-29T16:27:39Z")

</div>

Hi So I have this script - it runs fine on my desktop in my office but when I run it on my lab computer it shows the calibration screen but then goes black - following the display command (which is the start of the main…

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

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