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)

I still have similar Problems, but the errorr-message is the following:

Traceback (most recent call last):
File “C:\Program Files\PsychoPy3\lib\site-packages\psychopy\app_psychopyApp.py”, line 888, in onIdle
idle.doIdleTasks(app=self)
File “C:\Program Files\PsychoPy3\lib\site-packages\psychopy\app\idle.py”, line 105, in doIdleTasks
_doTask(taskName, app)
File “C:\Program Files\PsychoPy3\lib\site-packages\psychopy\app\idle.py”, line 142, in doTask
currentTask’func’
File “C:\Program Files\PsychoPy3\lib\site-packages\psychopy\app\pavlovia_ui\menu.py”, line 97, in setUser
pavlovia.getCurrentSession().setToken(token)
File “C:\Program Files\PsychoPy3\lib\site-packages\psychopy\projects\pavlovia.py”, line 412, in setToken
self.startSession(token)
File “C:\Program Files\PsychoPy3\lib\site-packages\psychopy\projects\pavlovia.py”, line 437, in startSession
self.gitlab.auth()
File "C:\Program Files\PsychoPy3\lib\site-packages\gitlab_init
.py", line 196, in auth
self.token_auth()
File "C:\Program Files\PsychoPy3\lib\site-packages\gitlab_init
.py", line 209, in token_auth
self.user = self.objects.CurrentUserManager(self).get()
File “C:\Program Files\PsychoPy3\lib\site-packages\gitlab\exceptions.py”, line 242, in wrapped_f
return f(*args, **kwargs)
File “C:\Program Files\PsychoPy3\lib\site-packages\gitlab\mixins.py”, line 68, in get
server_data = self.gitlab.http_get(self.path, **kwargs)
File "C:\Program Files\PsychoPy3\lib\site-packages\gitlab_init
.py", line 517, in http_get
streamed=streamed, **kwargs)
File "C:\Program Files\PsychoPy3\lib\site-packages\gitlab_init
.py", line 491, in http_request
response_body=result.content)
gitlab.exceptions.GitlabAuthenticationError: 401: 401 Unauthorized

I downloaded the last version of psychopy, removed and built in again the microphone component and it’s still not working. I also tried the things with the preferences.

The experiment shuts down at different points with saying:
2.4555 WARNING We strongly recommend you activate the PTB sound engine in PsychoPy prefs as the preferred audio engine. Its timing is vastly superior. Your prefs are currently set to use [‘pyo’, ‘sounddevice’, ‘pyo’, ‘pygame’] (in that order).

Experiment ended.