| Reference | Downloads | Github

PTB sound backend on Linux (virtual env): TypeError setting sound from array

I’ve come across a recurrent TypeError thrown by the psychtoolbox sound backend:

File “MYPATH/”, line 98, in
sound_1.setSound(‘A’, secs=5, hamming=True)
File “MYPATH/venv/lib/python3.8/site-packages/psychopy/sound/”, line 413, in setSound
_SoundBase.setSound(self, value, secs, octave, hamming, log)
File “MYPATH/venv/lib/python3.8/site-packages/psychopy/sound/”, line 178, in setSound
self._setSndFromNote(value.capitalize(), secs, octave,
File “MYPATH/venv/lib/python3.8/site-packages/psychopy/sound/”, line 213, in _setSndFromNote
self._setSndFromFreq(thisFreq, secs, hamming=hamming)
File “MYPATH/venv/lib/python3.8/site-packages/psychopy/sound/”, line 229, in _setSndFromFreq
File “MYPATH/venv/lib/python3.8/site-packages/psychopy/sound/”, line 489, in _setSndFromArray
self.track.fill_buffer(self.sndArr, start_index=1)
TypeError: fill_buffer() got an unexpected keyword argument ‘start_index’

Experiment ended.

The attachment gives a minimal builder example.
audiotest-ptb.psyexp (3.4 KB)

The sound plays fine with the sounddevice backend.

Any help would be much appreciated.

Thanks for flagging this up! Removing , start_index=1 fixes the error in so much as it allows the sound to play, but I’ll have to look a bit further into what effect this has.