| Reference | Downloads | Github

Problems with using microphone



I’m new to PsychoPy, and I have a problem, but I just can’t sort it out.

  • I’m running Psychopy 1.85.4 on a macOS High Sierra 10.13.3.
  • I’m new to psychopy and don’t know anything about Python’s code.
  • I’ve downloaded only the following from the ‘assets’, but is unsure whether anything else is needed: StandalonePsychoPy-1.

I’m trying to create a task where in the second loop I want to record the subjects answer (see picture 1). When I run the experiment without the microphone it works but when I add the microphone component it just freezes when I get to the point where it’s supposed to record (it freezes at the screen that corresponds to ‘test’ in the ‘test_loop’).

This is the error message I get:

Running: /Users/christinedyrsting/Desktop/PsychoPy set 1/

pyo version 0.8.6 (uses single precision)
2018-04-12 09:26:19.979 python[1827:126607] ApplePersistenceIgnoreState: Existing state will not be touched. New state will be written to (null)
Traceback (most recent call last):
File “/Users/christinedyrsting/Desktop/PsychoPy set 1/”, line 679, in
mic_1 = microphone.AdvAudioCapture(name=‘mic_1’, saveDir=wavDirName, stereo=False)
File “/Applications/”, line 357, in init
File “/Applications/”, line 402, in setMarker
sampleRate = sound.pyoSndServer.getSamplingRate()
AttributeError: ‘NoneType’ object has no attribute ‘getSamplingRate’
Exception RuntimeError: RuntimeError(‘sys.meta_path must be a list of import hooks’,) in <bound method ExperimentHandler.del of < object at 0x111ae5590>> ignored
Exception TypeError: “‘NoneType’ object is not callable” in <bound method Server.del of <pyolib.server.Server object at 0x112aad4d0>> ignored


I’ve looked at topics similar to this here in the forum, but haven’t been able to sort it out, so your help is much appreciated!

/ Christine



This line:

AttributeError: ‘NoneType’ object has no attribute ‘getSamplingRate’

means that the pyo audio server is not able to boot. Few things to consider:

  1. If the list order in the preferences matter, you should put ‘portaudio’ before ‘coreaudio’. The code for coreaudio support in pyo is very old, portaudio is much more reliable.
  2. Are you sure you have audio input (with enough channels) configured on the system?
  3. pyo 0.8.6 is a little bit old… 0.9.0 (current version) gently handles point number 2!