I’ve started testing the new pre-lease version hoping the newly implemented sounddevice backend will help deliver audio stimuli with shorter latencies.
I’m testing it both on a Windows 7 machine and various Mac OSX machines (running 10.11 and 10.12) using their respective standalone versions.
On MacOSX I’m running into major problems that seem to be connected to the sounddevice library - see the error message below triggered by
from psychopy import sound .
Do I need to download/install any additional libraries/modules to run this PsychoPy version? Manually installing sounddevice via pip didn’t help with the PsychoPy issue. I can now use the sounddevice library without problems outside of Psychopy (using Python3.6 via Anaconda).
Traceback (most recent call last): File "<input>", line 1, in <module> File "/Applications/PsychoPy2.app/Contents/Resources/lib/python2.7/psychopy/sound/__init__.py", line 72, in <module> File "/Applications/PsychoPy2.app/Contents/Resources/lib/python2.7/psychopy/sound/backend_sounddevice.py", line 12, in <module> File "/Applications/PsychoPy2.app/Contents/Resources/lib/python2.7/sounddevice/__init__.py", line 1, in <module> File "/Applications/PsychoPy2.app/Contents/Resources/lib/python2.7/sounddevice/sounddevice.py", line 227, in <module> File "cffi/api.pyc", line 105, in cdef File "cffi/api.pyc", line 119, in _cdef File "cffi/cparser.pyc", line 299, in parse File "cffi/cparser.pyc", line 304, in _internal_parse File "cffi/cparser.pyc", line 260, in _parse File "cffi/cparser.pyc", line 40, in _get_parser File "pycparser/c_parser.pyc", line 116, in __init__ File "pycparser/ply/yacc.pyc", line 3293, in yacc File "pycparser/ply/yacc.pyc", line 2938, in validate_all File "pycparser/ply/yacc.pyc", line 2982, in validate_modules File "inspect.pyc", line 690, in getsourcelines File "inspect.pyc", line 538, in findsource IOError: could not get source code
Using Windows 7 I was actually able to get PsychoPy to run using the new sounddevice library, however here I ran into a different issue which seems to be related to the new way in which the audio stream is initiated.
Here, using a previously tested script I replaced the pyo backend with sounddevice and got the following error messages when trying to play a dichotic (2-channel) audio stimulus:
From cffi callback <function callback_wrapper at 0x1409E1F0>: Traceback (most recent call last): File "C:\Program Files (x86)\PsychoPy2\lib\site-packages\sounddevice\sounddevice.py", line 1447, in callback_wrapper return _wrap_callback(callback, data, frames, time, status) File "C:\Program Files (x86)\PsychoPy2\lib\site-packages\sounddevice\sounddevice.py", line 2361, in _wrap_callback callback(*args) File "C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy-1.85.0rc3-py2.7.egg\psychopy\sound\backend_sounddevice.py", line 184, in callback toSpk[:len(dat), :] += dat # add to out stream ValueError: non-broadcastable output operand with shape (128,1) doesn't match the broadcast shape (128,2)
Any ideas how to go about this issue? Do I need to setup/initiate the out stream before I can present a stimulus using
sound.play( ) ?
Any help regarding either of the two issues is greatly appreciated!