Psychtoolbox interfaces between Matlab or Octave and the computer hardware. The PTB core routines provide high performance 2D and 3D graphics with the highest color and luminance precision, timing precision and control. This both on standard displays, as well as with special visual stimulators, and with High Dynamic Range displays, and with a wide variety of Virtual/Augmented Reality devices. They expose raw OpenGL commands, support video playback and capture, as well as low-latency precisely timed audio playback and capture. They facilitate the collection of observer responses with high timing precision via various input modalities like keyboard, mouse, game controllers, multi-touch touch screens, response boxes, gaze trackers, and digital / analog i/o equipment. Ancillary helper routines support common needs like color space transformations, calibration, and psychometric procedures like, e.g., the QUEST threshold seeking algorithm and others.

Various 3rd party frameworks and higher level toolboxes are built on top of Psychtoolbox to make implementation of research data collection especially easy in specific sub-domains of neuroscience. For beginners or certain domains there also exist user friendly 3rd party graphical user interfaces, e.g., PsyBuilder.

You can also run some of your Psychtoolbox studies online, via VPixx Labmaestro service under https://vpixx.com/products/labmaestro-packngo.

Psychtoolbox has many active users, an active forum, and is widely cited. The current version supports at least Matlab R2024b on Linux, Windows and macOS, and Octave 5 and later on Linux, and Octave 7.3 on Windows, and Octave 9 on macOS.

Psychtoolbox News

Psychtoolbox updated

kleinerm

Psychtoolbox 3.0.20 “Appletizer” was released at 13th December 2024, at least in some time zone. Hopefully Friday 13th will bring us luck instead of horror.

The complete development history can be found in our GitHub repository. The release tag is “3.0.20.0”, with the full tree and commit logs under the URL:

https://github.com/Psychtoolbox-3/Psychtoolbox-3/tree/3.0.20.0

This is the first release with beta quality macOS Apple Silicon Mac support for native use on Apple Macintosh computers with 64-Bit ARM Apple proprietary M1, M2, M3, … SoC’s.

We thank the labs of Keith Schneider at the University of Delaware and of Bas Rokers at NYU Abu Dhabi for substantial sponsorship to push Apple Silicon support over the finish line.

Effective immediately, the Psychtoolbox 3.0.19 series has now reached end of life. No improvements, bug fixes or user support will be provided for Psychtoolbox 3.0.19 or earlier versions of Psychtoolbox.

Compatibility changes wrt. Psychtoolbox 3.0.19.16:

  • Psychtoolbox 3.0.20 and later on Apple macOS and Microsoft Windows will require purchase of a paid software license key, once the initial time-limited free trial period after first installation and use has expired. Psychtoolbox will not work after the end of the trial period without such a paid license key. The Psychtoolbox variants for Linux on Intel processors and 32-Bit RaspberryPi will remain free to use for the time being.

    The free time-limited trial period will last until the launch of our new online shop, ie. until you will be able to buy software license keys. The estimated date of launch, and end of the free trial, will be likely around early to mid January 2025.

    Follow the news on http://psychtoolbox.org and on our Discourse user forum or our social media feeds @psychtoolbox on X / Twitter, https://neuromatch.social/@psychtoolbox on Mastodon, or on BlueSky <@psychtoolbox.bsky.social> for announcements of the launch of the software license key sale early in the year 2025, or go to https://psychtoolbox.net to find out how to buy a key, once sales has started.

Highlights:

  • Initial “Beta” Apple Silicon support for running Psychtoolbox on macOS for Apple Silicon Macs. Psychtoolbox can now be used with native Octave and Matlab for Apple Silicon ARM Macs, ie. machines with Apple M1, M2, M3, M4, … SoC’s. Most basic functionality should work reasonably well, and substantially better than when using older Psychtoolbox versions via Matlab for IntelMacs, which had various severe limitations which would make them painful to use and deeply hazardous for any real data collection! This versions Apple Silicon support was tested by myself on a Apple MacBookPro early 2023 with 16 inch Liquid Retina XDR display and Apple M2 Pro SoC under macOS 14.5 Sonoma with 64-Bit native Octave 9.2 from HomeBrew, and with Matlab R2024a and with Matlab R2024b. It was also more lightly tested by others on a similar 16 inch MacBookPro late 2023 with M3 Pro SoC under the macOS 15.2 Sequoia beta under Matlab R2024b, and a MacBookAir 2020 with M1 SoC, and a Mac Studio 2023 M2 Ultra and MacBookAir M3 13 inch early 2024, the latter two with macOS 15.2 beta and Matlab R2024b. Thanks to our volunteer testers.

    While surely some bugs or limitations still exist, this should be a first good release for basic use and evaluation.

    Known limitations are lack of frame-sequential stereo support in stereo modes 1 and 11, Screen Async flips, ie. subfunctions ‘AsyncFlipBegin’, ‘AsyncFlipEnd’ and ‘AsyncFlipCheckEnd’ are unsupported. Certain glitches in frame presentation timing are still observed under certain conditions at least on macOS 14, e.g., stalls / short freezes after the stimulus image was static for a while, e.g, observable with MouseTraceDemo if not moving the mouse for a while. These may also trigger printing of some warning messages into the Matlab or Octave Window about “…Failed to retrieve … stimulus onset timestamp! Timed out.”. It is not yet clear if these issues are still present on macOS 15 Sequoia as well, testing to be done. These remaining timing glitches are almost certainly due to Apple macOS operating system bugs, which will either need proper fixing by Apple, or need invention of new creative workarounds on our side, if that is needed and possible.

    Apples “ProMotion” display mode on some builtin Retina displays, e.g., of the MacBookPro models, and variable refresh rate modes in general, are not supported and will cause more erratic behaviour. Make sure to switch to a fixed refresh rate mode in display settings instead on such machines.

    Movie playback, movie writing and video capture works well with GStreamer 1.24.10, but due to what seem to be shortcomings or bugs of current GStreamer releases, video recording on Apple Silicon only works for video, not when also trying to record audio - otherwise hangs will occur. On Intel Macs, video recording does not work at all with GStreamer 1.24.10, but does for both video and audio with GStreamer 1.22, however with the downside that playback of some movies fails. So both GStreamer 1.22 and 1.24 have some limitations, pick the variant with limitations you can better live with, until GStreamer is properly fixed in some future GStreamer version.

    You should probably not yet use this release for real data collection if highest reliability of visual stimulus presentation timing is required. Use for less demanding scenarios may be fine, but tread carefully with this early release!

All:

  • Screen: Fix PsychNormalizeTextureOrientation() for multi-window use. Use of multiple onscreen windows could cause the wrong OpenGL context of the wrong onscreen window to be in use during operation. Fix this. Cfe. https://psychtoolbox.discourse.group/t/unknown-problem-playing-movies-with-gstreamer-on-ubuntu-linux/4876/8

  • Screen: Various improvements to movie playback. E.g., improve reliability of playback with pixelFormat 6 and 8.

  • Screen: Reduce chattiness of some status/debug output in general. Generally refine status output a bit.

  • AlphaRotateDemo.m: Small fixups for weirdly sized displays and formatting fixes. Especially useful for the Retina displays of 16 inch Apple Silicon MacBookPro, with a horizontal resolution that has an odd pixel count instead of an even count.

  • PsychPython/audio.py: Fix ‘AttributeError’ raised when creating a stream fails. Contributed by GitHub user @mdcutone.

  • PsychColorimetric/LMSToMacBoyn(): “Add an example and save the correct version”, some poorly documented fixes or improvements by the Brainard lab with commit messages that are mostly void of meaningful information, so I don’t know what they did.

  • Various other smaller refinements, bug fixes and documentation updates.

Linux:

  • Psychtoolbox was built and tested against Matlab R2024b and Octave 5.2 and later.

  • PsychVulkan: Only use workaround against an AMDVLK bug, which causes a crash if a used display monitor has more than 64 video modes, on AMDVLK driver versions before v-2024.Q4.2, as the bug has been fixed by AMD in the upstream driver version v-2024.Q4.2, released by AMD early December 2024.

Windows:

  • Psychtoolbox was built and tested against Matlab R2024b and Octave 7.3.

  • Screen: Drop GStreamer DirectShow video capture. Prioritize Mediafoundation. DirectShow video capture is unmaintained and strongly discouraged by GStreamer folks since the year 2022, and indeed testing shows it is quite broken now. WDM-KS kernel streaming is also deprecated since the year 2022. MediaFoundation capture is the only recommended way forward. Limited testing on Windows 10 22H2 also shows it to be the most capable and stable right now (tested GStreamer 1.22).

    Drop support for DirectShow dshowvideosrc completely, and prefer Mediafoundation mfvideosrc over the deprecated Kernel Streaming ksvideosrc.

  • PsychVulkan/Windows: Disable fullscreen exclusive mode on shoddy AMD Vulkan drivers again. This still does not work reliably and often leads to black screens instead of stimulus display. The error pattern was unpredictable, with fullscreen exclusive mode sometimes working throughout long sessions, then suddenly failing, with no way to fix it (even a reboot doesn’t help), then on another day suddenly working again for a streak of runs. Upside is a working display, but downside is impaired visual stimulus presentation timing reliability.

macOS:

  • Psychtoolbox was built and tested against native Matlab R2024b and against native Octave 9.2 from HomeBrew, on macOS 13.7.1 Ventura for Intel Macs, and on macOS 14.5 Sonoma for Apple Silicon Macs.

  • Initial support for running Psychtoolbox on macOS for Apple Silicon Macs with ARM native Matlab and Octave. See Highlights section above for more details.

  • Bump the minimum required macOS version to macOS 10.13 “High Sierra”. Effective this means that macOS 10.13 for IntelMacs, and macOS 11 “Big Sur” for Apple Silicon Macs are required to run Psychtoolbox 3.0.20.

    Of course this new minimum is a bit redundant, because all macOS versions older than macOS 13 are completely unsupported by Apple since October 2024, so running anything older is at least a high computer security risk, and has lots of unfixed remaining bugs and is therefore not a good idea. Additionally macOS 13 is needed at a minimum on Apple Silicon Macs to allow proper operation of visual stimulators from VPixx and Cambridge Research Systems.

  • Fix video recording on macOS. Works fully with video + audio on macOS for Intel Macs with GStreamer 1.22. Works with video only, no audio, on macOS for Apple Silicon Macs.

  • Implement initial pixelFormat 11 movie playback support on macOS for playback of Deep color, Wide color gamut (WCG), and High Dynamic Range (HDR) movies. This provides 10 bpc deep color, WCG and HDR, but at a lower performance than on other operating systems, as Apples prehistoric OpenGL 2.1 implementation forces us to use a less efficient decoding shader, and hardware accelerated video decoding can not be used as of GStreamer 1.24.10, as it would reduce color precision to only 8 bpc which is utterly insufficient for WCG and HDR playback, causing significant banding and HDR artefacts.

  • Make pixelFormat 6 playback work without crashing.

  • Screen: Make Intel iGPU pageflip checking on recent macOS for Intel graphics chips more robust. This may improve robustness of correctness checks on Intel integrated graphics on Intel Macs with PsychtoolboxKernelDriver installed. Problem seen and fixed on Intel Kabylake Gen 9.5 graphics of MacBookPro 2017.

  • Fix some crashes on Octave for macOS when using Psychtoolbox after issuing a “clear all”, or “clear mex”, or “clear Screen”, or “clear PsychVulkanCore” command.

Enjoy!

Psychtoolbox updated

kleinerm

Psychtoolbox 3.0.19.16 “Last free dessert” was released at 20th November 2024. The complete development history can be found in our GitHub repository. The release tag is “3.0.19.16”, with the full tree and commit logs under the URL:

https://github.com/Psychtoolbox-3/Psychtoolbox-3/tree/3.0.19.16

This Psychtoolbox release was sponsored by Mathworks under the year 2024 contract for establishing Matlab R2024b compatibility on Ubuntu 24.04 Linux and Windows 10.

Highlights:

  • None. This is a release with small fixes and tweaks, based on compatibility testing of Psychtoolbox with Ubuntu Linux 24.04.1-LTS and MS Windows-10 22H2 with Matlab R2024b under the Mathworks 2024 contract which requires at least one Psychtoolbox release that is compatible with R2024b under Linux and Windows.

    As such, no compatibility testing was performed wrt. macOS, apart from quick spot testing with R2024b, as testing on macOS was not part of the paid contract, and the contract pays way too little to cover any non-mandatory work.

    The total work time spent on R2024b testing and refinement was 42 hours.

    No compatibility issues were found with R2024b, compared to R2024a, iow. no regressions. All improvements in this release are for fixing / working around Microsoft Windows bugs or flaws, or AMD and NVidia graphics driver bugs on Windows. And some small tweaks and enhancements.

All:

  • RenderDemo: Add missing BackupCluts to not annoy the user. Restore the lut’s at the end of the demo, so display doesn’t look “milky” and dull.

  • FlipTimingWithRTBoxPhotoDiodeTest: Let audio card select its preferred sample rate. Some Some recent sound chips don’t like our hard-coded 44100 Hz, so let them choose their preferred rate.

  • PlayMoviesDemo: Cleanup web movies offering a bit.

  • PsychImaging: Some doc update wrt. Intel 10 bpc support on Ubuntu 22.04+.

Linux:

  • Psychtoolbox was extensively tested against Matlab R2024b, under Ubuntu 24.04.1-LTS Linux with AMD Polaris and Intel Kabylake graphics, also in dual-gpu configurations on a dual-gpu hybrid graphics Laptop.

Windows:

  • Psychtoolbox was extensively tested against Matlab R2024b, and lightly tested against Octave 7.3, both under MS-Windows 10 R22H2 with primarily AMD graphics, and spot checked with NVidia graphics.

  • MultiWindowLockStepTest: Fix failure in default dual-window 10/20 seconds async flip case on MS-Windows 10, due to interaction with an OpenGL quirk.

  • DrawManuallyAntiAliasedTextDemo: Add workaround for AMD OpenGL graphics driver bug on Windows-10. Ditto for TextToStuffColorMismatchTest.m.

Enjoy!

Psychtoolbox updated

kleinerm

Psychtoolbox 3.0.19 update “Last free lunch” was released at 3rd November 2024. The complete development history can be found in our GitHub repository. The release tag is “3.0.19.15”, with the full tree and commit logs under the URL:

https://github.com/Psychtoolbox-3/Psychtoolbox-3/tree/3.0.19.15

Compatibility changes wrt. Psychtoolbox 3.0.19.14:

  • None.

Highlights:

  • None. Only bug fixes for various 3rd party components, and small improvements.

All:

  • Change enumeration order of video capture devices. This should avoid selection of suboptimal capture devices by preferring more optimal ones, especially on modern Ubuntu 22.04-LTS and later Linux distributions, which often choose the new but immature pipewiresrc as video source plugin for a camera instead of the old and proven/mature more optimal v4l2src as video source. Specifically we hope to avoid VideoRecordingDemo.m problems like the ones encountered in the following thread:

    https://psychtoolbox.discourse.group/t/codecs-in-videorecordingdemo-not-working-on-linux/5441

  • PsychImaging: Fix HDR mode with types of PsychColorCorrection() that involve lookup tables and only use one color correction operation in total. E.g, standard LUT based correction, 3D LUT based correction or application of per-pixel gain matrices. See:

    https://psychtoolbox.discourse.group/t/best-approach-for-gamma-correction-in-hdr10/5515

  • CI release scripts: Disable building of .mltbx files for releases for now.

    The current approach contributed by Mathworks team is broken. It includes the whole Psychtoolbox-3 tree for some utterly unclear reason, although the project file only specified the Psychtoolbox/ subfolder. Worse, it adds toolbox folders to the Matlab path in randomized (!?!) order, so our carefully selected ordering of MatlabWindowsFilesR2007a/ folder wrt. PsychBasic folder gets screwed up and mex files can’t be found on MS-Windows anymore. Even worse, if SetupPsychtoolbox() fixes it, then the Matlab Add-On Manager undos the fix every single time Matlab restarts! This leads to issues like the following linked one:

    https://psychtoolbox.discourse.group/t/problem-with-screen-function-ptb-just-installed/5451/9

    Apart from that, the Add On manager doesn’t allow toolbox updates, and doesn’t set things like the Matlab Java path, doesn’t deal with GStreamer etc. It has zero benefit for our users, but is a source of hazarads and extra support overhead. Drop it.

  • Add Psychtoolbox/PsychBasic/PsychPlugins/ to the search path for dynamic shared libraries for all operating systems, so PTB specific plugin libraries can be found during mex file load time.

Linux:

  • Psychtoolbox was built and tested against Matlab R2024a and R2024b and Octave 5.2 and later.

  • PsychImaging: Update ‘EnableNative16BitFramebuffer’ help text for year 2024.

  • Screen: Fix Vulkan display backend support with Mesa versions 23.3 and later and thereby for Ubuntu 24.04-LTS and later. The same problem that affected the Broadcom VideoCore 6 of the RaspberryPi 4 and later under Mesa 23.3 now affects at least Intel and AMD under Mesa 24.0 with Ubuntu 24.04.0-LTS.

    It appears a slightly broken GL_EXT_direct_state_access implementation in Mesa was introduced in Mesa 23.3 and later. Work around this in an effective and safe way.

  • PsychVulkan: Add workaround against an AMDVLK bug that causes crash if the used Vulkan display monitor has more than 64 video modes. A proper fix, especially for multi-display setups, can only be done in a future AMDVLK driver from AMD’s Vulkan team, but for single display stimulation this workaround should prevent crashes and problems, and on some multi-display setups things may still work with a sprinkle of dumb luck - no guarantees for multi-display though! Note that the AMDVLK driver is only used on AMD gpu’s if a color depth of more than standard 8 bpc (aka “deep color”) or HDR-10 display mode is requested. For other Vulkan use cases, the high quality Mesa radv Vulkan driver is used, which does not suffer such a problem. For context see:

    https://psychtoolbox.discourse.group/t/vulkan-breaks-with-stack-smashing-detected-terminated/5501

  • XOrgConfCreator: Adapt to Ubuntu 24.04-LTS changes in /dev/dri/card enumeration. This broke hybrid graphics laptop detection, at least on three single gpu laptops with AMD gpu’s. It reported a dual-gpu config when there was not any. Since Ubuntu 24.04-LTS, or more likely with a recent Linux 6.8 kernel shipping in both Ubuntu 24.04-LTS and in Ubuntu 22.04.5-LTS with HWE stack, the first (and only) gpu on a single gpu machine now has a /dev/dri/card1 device file, instead of a /dev/dri/card0 device file, ie. device file indexing now starts at 1 instead of 0. On multi-gpu machines, the second gpu is now associated with /dev/dri/card2 and so on. This broke some hard-coded assumptions about 0-based device numbering. We now use a more robust detection logic for hybrid gpu detection. The fix was successfully tested on single-gpu AMD and Intel graphics machines, and on a dual-gpu Intel + AMD laptop for each gpu and in prime render offload mode.

  • Add braces for NetWM reporting to make compiler happier. It caused a weird problem in the Screen mex build for Matlab, in which the “PTB-INFO: …” lines about the used flip timestamping mechanism are not printed! No clue why, looks like some compiler bug, but adding the - technically not needed - braces fixes it.

Windows:

  • Psychtoolbox was built and lightly tested against Matlab R2024a and Octave 7.3 and extensively tested against Matlab R2024b.

  • VideoRecordingDemo.m: Remove special case MS-Windows path. It does not seem to be as necessary anymore with the future default MediaFoundation path for capture and recording. Also added some cleanups and ability to specify video capture device as argument.

macOS:

  • Psychtoolbox was built and tested against Matlab R2024a and against Octave 9.2 from HomeBrew.

Enjoy!

News Archive