MacOS M1
Python 3.8.20
PsychoPy Version: 2024.2.1
I’m running into a problem generating sound no matter what sound library I use
sounddevice seems to work fine on its own, but not with PsychoPy
PTB doesn’t import on it’s own
I get errors using pyo and pygame too
has anyone else had this problem? maybe there is a compatibility issue with M1?
here is my code:
from psychopy import sound, core
from psychopy import prefs
prefs.hardware['audioLib'] = ['sounddevice']
sound_stim = sound.Sound(value='A', secs=1.0) # Play a tone
sound_stim.play()
core.wait(2)
here is the error:
Traceback (most recent call last):
File "/Users/delacroix/.pyenv/versions/3.8.20/envs/psyenv/lib/python3.8/site-packages/psychopy/hardware/manager.py", line 250, in addDevice
device = cls(*args, **kwargs)
File "/Users/delacroix/.pyenv/versions/3.8.20/envs/psyenv/lib/python3.8/site-packages/psychopy/hardware/speaker.py", line 27, in __init__
if index < 0 or index not in available_index:
TypeError: '<' not supported between instances of 'NoneType' and 'int'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "psynote2.py", line 6, in <module>
sound_stim = sound.Sound(value='A', secs=1.0) # Play a tone
File "/Users/delacroix/.pyenv/versions/3.8.20/envs/psyenv/lib/python3.8/site-packages/psychopy/sound/backend_pygame.py", line 156, in __init__
self.speaker = self._parseSpeaker(speaker)
File "/Users/delacroix/.pyenv/versions/3.8.20/envs/psyenv/lib/python3.8/site-packages/psychopy/sound/_base.py", line 132, in _parseSpeaker
device = DeviceManager.addDevice(
File "/Users/delacroix/.pyenv/versions/3.8.20/envs/psyenv/lib/python3.8/site-packages/psychopy/hardware/manager.py", line 253, in addDevice
raise ManagedDeviceError(
psychopy.hardware.manager.ManagedDeviceError: '<' not supported between instances of 'NoneType' and 'int'
2.0940 ERROR Error encountered while loading `psychopy-sounddevice`. Check logs for more information.
2.2622 WARNING We strongly recommend you activate the PTB sound engine in PsychoPy prefs as the preferred audio engine. Its timing is vastly superior. Your prefs are currently set to use ['PTB', 'sounddevice', 'pyo', 'pygame'] (in that order).