Hi all,
Just wanted to say I managed to fix this and also share the solution. It turns out I was able to string together bits from some helpful posts from the old psychopy google group.
This post had some useful bits of code for stripping down to pyo basics, and I reproduced their problem+solution (i.e., same configuration and the server would start with maxChnls=2 but fail with >2). HOWEVER, this wasn’t necessary to actually get my script running with pyo! All I had to do was import prefs and change prefs.general['audioDriver'] = [u'jack']
and it worked. Good, so no messing with lower level functions!
However, I then ran into a different error when trying mic_trial = microphone.AdvAudioCapture(name=‘mic_trial’, filename=micfilename, stereo=False)
:
sampleRate = sound.pyoSndServer.getSamplingRate()
AttributeError: ‘NoneType’ object has no attribute ‘getSamplingRate'
This error has been previously discussed here and here. As far as I know, the problem is in the way psychopy sets up the microphone server, so maybe still a bug as of v1.85.3 (haven’t tried the latest psychopy v1.90).
I solved this second issue using the work around suggested by Nicolas in the second post, which involved hard coding the two lines in psychopy/microphone.py using the sound.pyoSndServer.getSamplingRate()
to instead just set the sampleRate = 44100
. Note that I chose this value because it’s the default sampling rate listed in the pyo Server documentation, which goes against the original post’s suggestion that it’s mostly likely 48000. I don’t know how to confirm which is “correct”, but I can say my script now works.
Hope this helps someone else!
Cheers,
Colin