OS (Win10):
PsychoPy version (2022.2.4):
What are you trying to achieve?:
Microphone recording that starts at the beginning of a routine, and ends on button press
What did you try to make it work?:
I selected the microphone array
What specifically went wrong when you tried that?:
I get the following error message. I tried using the default microphone settings in the component, and got the following. I also tried using other settings but got the same message.
Hello from the pygame community. Contribute - pygame wiki
PTB-ERROR: Failed to open audio device 5. PortAudio reports this error: Invalid device
Traceback (most recent call last):
PTB-ERROR: Desired audio parameters likely unsupported by audio device.
PTB-ERROR: This could be, e.g., due to an unsupported combination of audio sample rate, audio channel count/allocation, or audio sample format.
Error in function Open: Usage error
Failed to open PortAudio audio device due to unsupported combination of audio parameters.
PsychPortAudio:Open: Usage:
pahandle = PsychPortAudio(‘Open’ [, deviceid][, mode][, reqlatencyclass][, freq][, channels][, buffersize][, suggestedLatency][, selectchannels][, specialFlags=0]);
4.7025 WARNING User requested fullscreen with size [1536 864], but screen is actually [1920, 1080]. Using actual size
File “C:\Users\james\Documents\ZDesktop\PhD\Switching Study\Tasks\All EEG tasks\AllTasksEEG_lastrun.py”, line 450, in
mic = sound.microphone.Microphone(
File “C:\Program Files\PsychoPy2022\lib\site-packages\psychopy\sound\microphone.py”, line 478, in init
self._stream = audio.Stream(
File “C:\Program Files\PsychoPy2022\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 0x000001D909532F70>
Traceback (most recent call last):
File “C:\Program Files\PsychoPy2022\lib\site-packages\psychtoolbox\audio.py”, line 236, in del
self.close()
File “C:\Program Files\PsychoPy2022\lib\site-packages\psychtoolbox\audio.py”, line 146, in close
raise err
File “C:\Program Files\PsychoPy2022\lib\site-packages\psychtoolbox\audio.py”, line 139, in close
PsychPortAudio(‘Close’, self.handle)
AttributeError: ‘Stream’ object has no attribute ‘handle’
1.0203 WARNING Monitor specification not found. Creating a temporary one…
################ Experiment ended with exit code 1 [pid:27424] #################
I also tried using the code import psychopy.sound.microphone.Microphone as Microphone, by following the overview here: Microphone - for recording sound — PsychoPy v2022.2.4, however in that case I got the error message. However, I received the message
ModuleNotFoundError: No module named ‘psychopy.sound.microphone.Microphone’; ‘psychopy.sound.microphone’ is not a package
This might be because I haven’t installed psychtoolbox, but since psychtoolbox runs in MATLAB I don’t see the connection.