psychopy.org | Reference | Downloads | Github

Microphone input not working in Windows on simple naming experiment

Dear all,

I cannot record audio from the microphone using the builder. It just crashes when it runs to the Microphone Component. I am not sure if it is a problem with my computer or the programming language. The error message is as below:

6.7153 WARNING User requested fullscreen with size [1366 768], but screen is actually [1920, 1080]. Using actual size
8.0611 WARNING Starting Microphone but sound lib preference is set to be [‘sounddevice’, ‘pyo’, ‘pygame’]. Clashes might occur since ‘pyo’ is not preferred lib but is needed for Microphone
8.0707 ERROR psychopy.sound.backend_pyo.init could not find speaker hardware; sound not available
Traceback (most recent call last):
File “E:\Research\Stimuli\Lexical\Taskswitch_lexical_lastrun.py”, line 1100, in
mic_cant = microphone.AdvAudioCapture(name=‘mic_cant’, saveDir=wavDirName, stereo=True, chnl=‘0’)
File “C:\Users\aml78\AppData\Local\PsychoPy3\lib\site-packages\psychopy\microphone.py”, line 386, in init
buffering=buffering, chnl=chnl, stereo=stereo)
File “C:\Users\aml78\AppData\Local\PsychoPy3\lib\site-packages\psychopy\microphone.py”, line 174, in init
raise AttributeError(‘pyo server not created’)
AttributeError: pyo server not created

Tested with Psychopy 3.1.2. Thanks a bunch!

Best,
Anthony

What are the settings in your PsychoPy preferences for the sound driver? Make sure that the directsound is listed (on Windows systems) as below

Thanks a lot, Jon. I tried using all the specification as shown on your screenshot (apart from the last item on ‘parallel ports’ since I can’t see this, although I am not sure it is critical), the same problem still remains:

Traceback (most recent call last):
File “C:\Users\Documents\PhD\Research\Stimuli\Lexical\Taskswitch_lexical_lastrun.py”, line 1138, in
mic_cant.record(sec=3, block=False) # start the recording thread
File “C:\Program Files (x86)\PsychoPy3\lib\site-packages\psychopy\microphone.py”, line 398, in record
self.filename = self._record(sec, filename=filename, block=block)
File “C:\Program Files (x86)\PsychoPy3\lib\site-packages\psychopy\microphone.py”, line 249, in _record
self.recorder.run(self.savedFile, self.duration, **self.options)
File “C:\Program Files (x86)\PsychoPy3\lib\site-packages\psychopy\microphone.py”, line 117, in run
inputter = pyo.Input(chnl=chnl, mul=1)
File “C:\Program Files (x86)\PsychoPy3\lib\site-packages\pyo\lib\generators.py”, line 420, in init
pyoArgsAssert(self, “iOO”, chnl, mul, add)
File “C:\Program Files (x86)\PsychoPy3\lib\site-packages\pyo\lib_core.py”, line 503, in pyoArgsAssert
raise PyoArgumentTypeError(err % (i, name, expected, argtype))
pyo.lib._core.PyoArgumentTypeError: bad argument at position 0 to “Input” (integer expected, got <class ‘str’>)

AH, OK, this one is fixed in the repository and will be done in 3.1.3 (imminent)

Hi, Jon, I experienced the same problems. I have upgraded my psychopy into 3.1.3, but it is still not work. How can I fix this problem?

Could you just confirm, is it still this exact same error message ending in

bad argument at position 0 to “Input” (integer expected, got <class ‘str’>)

or is it a different message now?

I was helping one of my users last week and they experienced the same error with version 3.1.3 when trying to capture audio from the mic:

File “C:\Program Files (x86)\PsychoPy3\lib\site-packages\pyo\lib_core.py”, line 503, in pyoArgsAssert
raise PyoArgumentTypeError(err % (i, name, expected, argtype))
pyo.lib._core.PyoArgumentTypeError: bad argument at position 0 to “Input” (integer expected, got <class ‘str’>)

Yeah, Here is the error information.
File “C:\Users\Xia Tao\Desktop\Tao_TMR\session1_study_lastrun.py”, line 1921, in
mic_1.record(sec=15, block=False) # start the recording thread
File “C:\Users\Xia Tao\AppData\Roaming\psychopy3\versions\psychopy\microphone.py”, line 398, in record
self.filename = self._record(sec, filename=filename, block=block)
File “C:\Users\Xia Tao\AppData\Roaming\psychopy3\versions\psychopy\microphone.py”, line 249, in _record
self.recorder.run(self.savedFile, self.duration, **self.options)
File “C:\Users\Xia Tao\AppData\Roaming\psychopy3\versions\psychopy\microphone.py”, line 117, in run
inputter = pyo.Input(chnl=chnl, mul=1)
File “E:\PsychoPy3\lib\site-packages\pyo\lib\generators.py”, line 420, in init
pyoArgsAssert(self, “iOO”, chnl, mul, add)
File “E:\PsychoPy3\lib\site-packages\pyo\lib_core.py”, line 503, in pyoArgsAssert
raise PyoArgumentTypeError(err % (i, name, expected, argtype))
pyo.lib._core.PyoArgumentTypeError: bad argument at position 0 to “Input” (integer expected, got <class ‘str’>)

Right, OK. I know what’s happened I think.

We fixed the issue for newly created mic components but didn’t retrospectively enforce the fix to experiments created in the past. You work around that in 3.1.3 by removing and adding back your mic Component.

I’ve just implemented a further fix for 3.1.4 that forces the same change during the loading of previous experiments as well.

It works!!! Thank you so much!

OK, good to know that fixed it. The fix will be there as standard in 3.1.4 (imminent)