psychopy.org | Reference | Downloads | Github

Microphone does not work, AttributeError: 'NoneType' object has no attribute 'getSamplingRate'

Hi everybody,

I ran into a problem when I included the microphone response to my experiment. I get this error

#### Running: /Users/reinhard/Desktop/Experiment/Test session2.1_lastrun.py ####
pyo version 0.8.6 (uses single precision)
2017-12-17 16:30:17.408 python[4763:92002] ApplePersistenceIgnoreState: Existing state will not be touched. New state will be written to (null)
Traceback (most recent call last):
  File "/Users/reinhard/Desktop/Experiment/Test session2.1_lastrun.py", line 224, in <module>
    mic_1 = microphone.AdvAudioCapture(name='mic_1', saveDir=wavDirName, stereo=False)
  File "/Applications/PsychoPy2.app/Contents/Resources/lib/python2.7/psychopy/microphone.py", line 357, in __init__
    self.setMarker()
  File "/Applications/PsychoPy2.app/Contents/Resources/lib/python2.7/psychopy/microphone.py", line 402, in setMarker
    sampleRate = sound.pyoSndServer.getSamplingRate()
AttributeError: 'NoneType' object has no attribute 'getSamplingRate'

This seems to be a common problem. Unfortunately, I wasn’t able to find any fixes for this in other discussions. I tried to switch around the ‘pyo’ and ‘pygame’ audio libraries.
Without the microphone response, my experiment works fine.
Is it somehow possible to let my participants record during the experiment? Maybe alternatively with a different time-matched program - I don’t know how/whether it would be possible to link Psychopy with an audio recorder like Audacity…

I have a Macbook Air with OS High Sierra.

Thank you in advance!

The Server (I’m talking for pyo here) can’t instantiate. That means something wrong between pyo’s config and system’s config. The only difference for pyo with or without the mic is the duplex mode. When in duplex, it tries to open both output and input streams (while only output streams when duplex if off). Have you checked in the Audio Midi Setup if the audio input is available, with enough channels and corect sampling rate?

Thank you very much! The audio input is available with 2 channels. The sampling rate could be the crux and I will play around with it, maybe that will solve the issue.