If this template helps then use it. If not then just delete and start from scratch.
OS (e.g. Win10): Win10
PsychoPy version (e.g. 1.84.x): 2022.2.2
Standard Standalone? (y/n) If not then what?: Yes
What are you trying to achieve?: using microphone to record each production in multiple routines
What did you try to make it work?: I was able to record when there was only one routine, but the exp failed as soon as I added in another routine.
What specifically went wrong when you tried that?: When i tried to use the PTB driver, here is the error message that I encountered:
PTB-ERROR: Failed to open audio device 8. PortAudio reports this error: Invalid device
Traceback (most recent call last):
File “C:\Users\labuser\Desktop\hsc_dissertation\production\practice_session\run_psychopy_minimal_working_example_lastrun.py”, line 184, in
q1_mic = sound.microphone.Microphone(
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\sound\microphone.py”, line 478, in init
self._stream = audio.Stream(
File “C:\Program Files\PsychoPy\lib\site-packages\psychtoolbox\audio.py”, line 97, in init
self.handle = PsychPortAudio(‘Open’, device_id, mode,
Exception: Failed to open PortAudio audio device due to unsupported combination of audio parameters.
Exception ignored in: <function Stream.del at 0x000001F957A7AF70>
Traceback (most recent call last):
File “C:\Program Files\PsychoPy\lib\site-packages\psychtoolbox\audio.py”, line 236, in del
self.close()
File “C:\Program Files\PsychoPy\lib\site-packages\psychtoolbox\audio.py”, line 146, in close
raise err
File “C:\Program Files\PsychoPy\lib\site-packages\psychtoolbox\audio.py”, line 139, in close
PsychPortAudio(‘Close’, self.handle)
AttributeError: ‘Stream’ object has no attribute ‘handle’
################ Experiment ended with exit code 1 [pid:12824] #################
I have encountered similar error as well when I used sounddevice as the driver.
File “C:\Users\labuser\Desktop\hsc_dissertation\production\practice_session\run_psychopy_minimal_working_example_lastrun.py”, line 184, in
q1_mic = sound.microphone.Microphone(
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\sound\microphone.py”, line 478, in init
self._stream = audio.Stream(
File “C:\Program Files\PsychoPy\lib\site-packages\psychtoolbox\audio.py”, line 97, in init
self.handle = PsychPortAudio(‘Open’, device_id, mode,
Exception: Failed to open PortAudio audio device due to unsupported combination of audio parameters.
Exception ignored in: <function Stream.del at 0x000001697F73CF70>
Traceback (most recent call last):
File “C:\Program Files\PsychoPy\lib\site-packages\psychtoolbox\audio.py”, line 236, in del
self.close()
File “C:\Program Files\PsychoPy\lib\site-packages\psychtoolbox\audio.py”, line 146, in close
raise err
File “C:\Program Files\PsychoPy\lib\site-packages\psychtoolbox\audio.py”, line 139, in close
PsychPortAudio(‘Close’, self.handle)
AttributeError: ‘Stream’ object has no attribute ‘handle’
0.9432 WARNING Monitor specification not found. Creating a temporary one…
################ Experiment ended with exit code 1 [pid:12664] #################
It really does seem to me that somehow PsychoPy cannot open another microphone even though the recording parameters are entirely the same as the first microphone. I have attached my PsychoPy minimal working example below.
working_exp_2022_08_15.zip (101.3 KB)
Any help is appreciated given that I am in a time crunch and I would love to use this recording function for my experiment.