psychopy.org | Reference | Downloads | Github

Microphone doesn't work

I tried to run the ‘latencyFromTone.py’ file in the psychopy demo, this happened:

Traceback (most recent call last):
  File "/Users/experimenter/Documents/test_code/audio_recorder_test.py", line 34, in <module>
    microphone.switchOn()
  File "/Applications/PsychoPy2.app/Contents/Resources/lib/python2.7/psychopy/microphone.py", line 1146, in switchOn
    sound.pyoSndServer.setSamplingRate(sampleRate)
AttributeError: 'NoneType' object has no attribute 'setSamplingRate'
1 Like

Same error here. Can anyone help? I need to gain my PhD

OK, that’s fixed in this commit to the repository:
https://github.com/psychopy/psychopy/commit/68df98967d491a70f2c002ba372bdf1419e1fc86

You can download the file psychopy/microphone.py from there and replace it in your own, and there are two small changes to latencyFromTone.py that you need to make (that you can also see there).

At some point I’ll try to make the mic a little easier - Jeremy used to look after that but he’s been busy with other things lately.