In PsychoPy 3.1.1 and 3.1.2 standalone on Windows 10-64bit, the microphone doesn't work and causes the program to stop with the following message:
Running: D:UsersteodoDocumentsMy ExperimentsPsychoPy2_Petriciws1withMicro_lastrun.py
pygame 1.9.4
Hello from the pygame community. https://www.pygame.org/contribute.html
10.4474 WARNING Monitor specification not found. Creating a temporary one...
10.4505 WARNING User requested fullscreen with size [1536 864], but screen is actually [1920, 1080]. Using actual size
Traceback (most recent call last):
File "D:UsersteodoDocumentsMy ExperimentsPsychoPy2_Petriciws1withMicro_lastrun.py", line 392, in
mic_1.record(sec=5.0, block=False) # start the recording thread
File "C:Program FilesPsychoPy3libsite-packagespsychopymicrophone.py", line 398, in record
self.filename = self._record(sec, filename=filename, block=block)
File "C:Program FilesPsychoPy3libsite-packagespsychopymicrophone.py", line 249, in _record
self.recorder.run(self.savedFile, self.duration, **self.options)
File "C:Program FilesPsychoPy3libsite-packagespsychopymicrophone.py", line 117, in run
inputter = pyo.Input(chnl=chnl, mul=1)
File "C:Program FilesPsychoPy3libsite-packagespyolibgenerators.py", line 420, in __init__
pyoArgsAssert(self, "iOO", chnl, mul, add)
File "C:Program FilesPsychoPy3libsite-packagespyolib_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
This is a simple lexical decision task which works fine with a keyboard, but after adding the microphone building block, the above error message keeps popping up.
With best regards,
Teodor
What are your sound lib settings?
I am not sure if this is the answer to expect.
The audio library settings in the hardware section contains the following line:
['pyo', 'sounddevice', 'pygame', ]
The other settings there are:
Audio driver:
['directsound', 'Primary Sound', 'ASIO', 'Audigy', ]
Audio device: Primary Sound Driver (i.e. Realtek HD)
Parallel ports: ['0x0378', '0x03BC', ]
qmix_config
I have tried different settings from some other posts with a similar mic issue (psychopy crash).
With best regards,
Teodror
OK, great, thanks. Just wanted to check exactly the driver/lib settings so we can try to replicate.
The error is the result of a string arg being passed to the channel param when the microphone is initialised. This causes the error as the channel param must be passed an int. A string is passed because the channel param was given a valType of str. This error was fixed in https://github.com/psychopy/psychopy/pull/2425/commits/b262fba343f5d733665b5f7d4a5db9b81ca2c283 but was not pulled in to the release because the commit message lacks the BF prefix.
I have changed valType from str to int in two files according to the fix in b262fba and set the channel value back to default 0 in the channel line of the mic_properties (in builder view). This works well on my PC with the before used lexical decision task (i.e. for each trial, the responding voice was recorded for the desired duration)
Is this merged with mainline? I have the newest download and am still getting the vaType error?
Yes, it is merged into the master branch and also released in version 3.1.4. Could you double check that the version being used by your script is the version you expect?
Most helpful comment
I have changed valType from str to int in two files according to the fix in b262fba and set the channel value back to default 0 in the channel line of the mic_properties (in builder view). This works well on my PC with the before used lexical decision task (i.e. for each trial, the responding voice was recorded for the desired duration)