Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 3 additions & 28 deletions eegnb/experiments/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,35 +23,10 @@
VisualSSVEP = MissingExperiment

try:
from psychopy import sound, plugins, prefs
import platform
import logging

# PTB does not yet support macOS Apple Silicon freely, need to fall back to sounddevice.
if platform.system() == 'Darwin' and platform.machine() == 'arm64':
# import psychopy_sounddevice.backend_sounddevice
plugins.scanPlugins()
success = plugins.loadPlugin('psychopy-sounddevice')
print(f"psychopy_sounddevice plugin loaded: {success}")
from psychopy import prefs

# Force reload sound module
import importlib
importlib.reload(sound)

# Try to set the audio device if requested and available
audio_device = prefs.hardware.get('audioDevice', 'default')
if audio_device and audio_device != 'default':
if hasattr(sound, 'setDevice'):
try:
sound.setDevice(audio_device)
except Exception as e:
logging.warning(f"Failed to set audio device to '{audio_device}': {e}")
else:
logging.warning(f"sound.setDevice not available, could not set device to '{audio_device}'")
else:
#change the pref library to PTB and set the latency mode to high precision
prefs.hardware['audioLib'] = 'PTB'
prefs.hardware['audioLatencyMode'] = 3
prefs.hardware['audioLib'] = 'PTB'
prefs.hardware['audioLatencyMode'] = 3
except ImportError:
import logging
# logging.warning("PsychoPy not found. Stimulus presentation experiments will not be available.")
Expand Down
1 change: 0 additions & 1 deletion environments/eeg-expy-full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ dependencies:
- liblsl # install liblsl to prevent error on macOS and Ubuntu: "RuntimeError: LSL binary library file was not found."
- wxpython>=4.0 # install wxpython to prevent error on macOS arm64: "site-packages/wx/_core.cpython-38-darwin.so, 0x0002): symbol not found in flat namespace '__ZN10wxBoxSizer20InformFirstDirectionEiii'"
- html2text # avoid building wheel
- cffi # Fix sound ffi.callback() issue with sounddevice on macOS: https://github.com/spatialaudio/python-sounddevice/issues/397
- pip
- pip:
# Install package with only Analysis requirements
Expand Down
1 change: 0 additions & 1 deletion environments/eeg-expy-stimpres.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ dependencies:
- setuptools
- dukpy==0.2.3 # psychopy dependency, avoid failing due to building wheel on win 3.9.
- wxpython>=4.0 # install wxpython to prevent error on macOS arm64: "site-packages/wx/_core.cpython-38-darwin.so, 0x0002): symbol not found in flat namespace '__ZN10wxBoxSizer20InformFirstDirectionEiii'"
- cffi # Fix sound ffi.callback() issue with sounddevice on macOS: https://github.com/spatialaudio/python-sounddevice/issues/397
- pip
- pip:
# Install package with Analysis + Streaming requirements
Expand Down
129 changes: 0 additions & 129 deletions psychopy-sounddevice/.gitignore

This file was deleted.

Empty file removed psychopy-sounddevice/CHANGELOG.txt
Empty file.
Loading
Loading