We want to present acoustic stimuli using the Steinberg UR22mkII. An interface in Python, we rely on the sounddevice module (GitHub - spatialaudio/python-sounddevice: Play and Record Sound with Python ). Unfortunately, so far, we did not manage to present our sounds in WASAPI exclusive mode. We are facing a massive delay. A detailed description of the problem is posted on Github:
opened 12:24PM - 15 Oct 18 UTC
closed 04:40PM - 04 Aug 20 UTC
I have already posted in the psychopy forum: [Massive Sound lag using PsychoPy](… https://discourse.psychopy.org/t/massive-sound-lag-using-psychopy-windows-wasapi-for-external-sound-card/5530). I am stuck. Trying to activate exclusive mode as described in the [documentation of sounddevice](https://python-sounddevice.readthedocs.io/en/0.3.12/api.html#sounddevice.WasapiSettings) results in `PaErrorCode -9996`.
```
Traceback (most recent call last):
File "D:\Experimente\task1.py", line 85, in <module>
sound_1 = sound.Sound('A', secs=-1, stereo=True)
File "C:\Program Files (x86)\PsychoPy3\lib\site-packages\psychopy\sound\backend_sounddevice.py", line 296, in __init__
hamming=self.hamming)
File "C:\Program Files (x86)\PsychoPy3\lib\site-packages\psychopy\sound\backend_sounddevice.py", line 343, in setSound
blockSize=self.blockSize)
File "C:\Program Files (x86)\PsychoPy3\lib\site-packages\psychopy\sound\backend_sounddevice.py", line 84, in getStream
blockSize=blockSize)
File "C:\Program Files (x86)\PsychoPy3\lib\site-packages\psychopy\sound\backend_sounddevice.py", line 128, in _getStream
device=defaultOutput)
File "C:\Program Files (x86)\PsychoPy3\lib\site-packages\psychopy\sound\backend_sounddevice.py", line 159, in __init__
callback=self.callback)
File "C:\Program Files (x86)\PsychoPy3\lib\site-packages\sounddevice.py", line 1373, in __init__
**_remove_self(locals()))
File "C:\Program Files (x86)\PsychoPy3\lib\site-packages\sounddevice.py", line 779, in __init__
'Error opening {0}'.format(self.__class__.__name__))
File "C:\Program Files (x86)\PsychoPy3\lib\site-packages\sounddevice.py", line 2571, in _check
raise PortAudioError(errormsg, err)
sounddevice.PortAudioError: Error opening OutputStream: Invalid device [PaErrorCode -9996]
```
Do you have an idea on what is going wrong? Is there a bug? @peircej @mgeier @bastibe
It appears that the problem is raised because different instances of the device have the same name. Calling the appropriate instance by its ID at least enabled me playing a sound: sound.setDevice(10, kind='output') But, I still did not manage to...
Any help is highly appreciated.