Skip to main content

psychmetal

Native Metal stimulus presentation and Core Audio sound on Apple silicon Macs, from Python, with an interface resembling Psychtoolbox's Screen. There is no OpenGL anywhere in the path. The same engine serves PsychMetal for MATLAB and Octave.

Version 0.10.0 runs on Apple silicon Macs and in the separately built iPhone/iPad app. It has audio (sounds scheduled to the sample or to a frame, amplitude modulation on the same clock, recording and a voice key), native timelines with keyframes and live control, analytic masks, masked images, custom fragment shaders, and environment reports. See AUDIO.md, TIMELINE.md, GPU-MASKS.md, MASKED-IMAGES.md and CUSTOM-SHADERS.md in the source tree.

Install it into a virtual environment. Homebrew's Python (and any Python following PEP 668) refuses packages installed outside one:

python3 -m venv ~/venvs/psychmetal          # once
source ~/venvs/psychmetal/bin/activate      # in each new Terminal window
pip install /path/to/PsychMetal-0.10.0       # the source folder, or a release wheel

Requires macOS 14 or later on Apple silicon, an arm64 Python 3.10 or later, and numpy.

import psychmetal as pm

with pm.open_window(0, [0, 0, 0]) as (w, rect, ifi):
    pm.fill_rect(w, [255, 0, 0], [100, 100, 300, 300])
    vbl, onset, flip_return, missed, slipped = pm.flip(w)
    pm.wait_secs(1)

Each PsychMetal command is a function with the snake_case name and the same arguments, order and defaults as in MATLAB; MATLAB's [] is None. Colours run 0–255 by default. Key indices are 0-based (kb_name('ESCAPE') is 40). Several rectangles, dot positions and per-item colours keep MATLAB's 4xN, 2xN and 3xN/4xN orientation, and images are numpy arrays (H, W[, C]) in any memory layout, read without copying. help(psychmetal) covers threading, batching and the other details.

Demos and hardware checks (Gabors, dynamic noise, textures, dot motion, keyboard, a live spectrogram with a recorder, phase and frequency matching of flicker and sound, an inventory of every command) are in the repository's python folder.

Flip timestamps come from Metal's presentation reports, and sound times from Core Audio's, not from a photodiode or a microphone. See the repository for validation and its limits.

info = pm.open_audio()
beep = pm.make_sound(pm.tone(1000, 0.05, info['rate']))
pm.play(beep, when=pm.get_secs() + 0.5)
print(pm.audio_results(wait=1))     # when it started, on the sample nearest the time asked
pm.close_audio()

pm.play_timeline(w, frames, tracks) replays a queued scene natively, with no per-frame Python calls; timeline_demo.py shows it. pm.draw_masked_texture applies analytic GPU coverage to an image; masked_image_demo.py shows it. pm.stop() ends a running experiment, including native playback and waits.

MIT license.

Metadata

Release files for psychmetal 0.10.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for psychmetal 0.10.0
File Size Uploaded
psychmetal-0.10.0.tar.gz 248.5 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for psychmetal 0.10.0
File
psychmetal-0.10.0-cp314-cp314-macosx_14_0_arm64.whl CPython 3.14 CPython 3.14 macOS 14.0+ ARM64 Details
psychmetal-0.10.0-cp313-cp313-macosx_14_0_arm64.whl CPython 3.13 CPython 3.13 macOS 14.0+ ARM64 Details
psychmetal-0.10.0-cp312-cp312-macosx_14_0_arm64.whl CPython 3.12 CPython 3.12 macOS 14.0+ ARM64 Details
psychmetal-0.10.0-cp311-cp311-macosx_14_0_arm64.whl CPython 3.11 CPython 3.11 macOS 14.0+ ARM64 Details
psychmetal-0.10.0-cp310-cp310-macosx_14_0_arm64.whl CPython 3.10 CPython 3.10 macOS 14.0+ ARM64 Details

Total release size: 2.4 MB

Release files / psychmetal-0.10.0.tar.gz

Download URL psychmetal-0.10.0.tar.gz
Size 248.5 kB
Tags Source
SHA-256 checksum
How to use checksums
9929214fe5573ec1710a2d7e018bb94856ef3c3b83be78de7a15621e81f0963b
BLAKE2b-256 checksum
How to use checksums
d1ecc74caab66cf307d725b6c006b405fec69413cc02f49329840028db2b27b7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 16, 2026.

Transparency log

Release files / psychmetal-0.10.0-cp314-cp314-macosx_14_0_arm64.whl

Download URL psychmetal-0.10.0-cp314-cp314-macosx_14_0_arm64.whl
Size 429.0 kB
Tags CPython 3.14 macOS 14.0+ ARM64
SHA-256 checksum
How to use checksums
67ff5856c6d1ade769aef689a50fb195006f3693044fb55fe4c9b96775ac1c96
BLAKE2b-256 checksum
How to use checksums
5d5588c024b0073dab76dcd23fa82dd344c5eb2f37b54570eb04a0bd0f520257
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 16, 2026.

Transparency log

Release files / psychmetal-0.10.0-cp313-cp313-macosx_14_0_arm64.whl

Download URL psychmetal-0.10.0-cp313-cp313-macosx_14_0_arm64.whl
Size 428.9 kB
Tags CPython 3.13 macOS 14.0+ ARM64
SHA-256 checksum
How to use checksums
6ac8e6b9ec51ae9a1861f3e74a365938151ffe295d4493a5df17289480ffc887
BLAKE2b-256 checksum
How to use checksums
c614606ff15fbbdf7ac84f78a5a5cd4334f73b968c4461f36d41b28e5fc5d27f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 16, 2026.

Transparency log

Release files / psychmetal-0.10.0-cp312-cp312-macosx_14_0_arm64.whl

Download URL psychmetal-0.10.0-cp312-cp312-macosx_14_0_arm64.whl
Size 428.9 kB
Tags CPython 3.12 macOS 14.0+ ARM64
SHA-256 checksum
How to use checksums
9ad88825a524cf7cd7262cb58cbec6c84eded5f9277eabe418fb8ed12d3225ff
BLAKE2b-256 checksum
How to use checksums
7382b9081c6d004850316f796dbd9fd757b3927eed0b1fb8204fea54e1e3e912
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 16, 2026.

Transparency log

Release files / psychmetal-0.10.0-cp311-cp311-macosx_14_0_arm64.whl

Download URL psychmetal-0.10.0-cp311-cp311-macosx_14_0_arm64.whl
Size 428.9 kB
Tags CPython 3.11 macOS 14.0+ ARM64
SHA-256 checksum
How to use checksums
a21fdae2e1d5d4848ec5b3f3e9e0c4b98289ae09c5f135e3c6b26637bb93046d
BLAKE2b-256 checksum
How to use checksums
3dbec4511f3d5a72131a0fd46c7b016495264f39b4e6cd8be4b53e66409b0f80
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 16, 2026.

Transparency log

Release files / psychmetal-0.10.0-cp310-cp310-macosx_14_0_arm64.whl

Download URL psychmetal-0.10.0-cp310-cp310-macosx_14_0_arm64.whl
Size 429.0 kB
Tags CPython 3.10 macOS 14.0+ ARM64
SHA-256 checksum
How to use checksums
c430d7ff9d432a4a3333b99c5d581037c85050bf6c220f10bdd2742686d853fd
BLAKE2b-256 checksum
How to use checksums
276b496ebf4447fba2f3487d68003c44a4b30f37008c5c1dc6a1ce2acd20a9fc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 16, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.10.0 This release

6 release files

0.9.0

6 release files

0.7.1

6 release files

0.7.0

6 release files

0.6.0

6 release files

0.5.1

6 release files

0.5.0

6 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page