Hello PsychoPY community,
I am weirdly having some issues regarding a sound component in my experiment. I am saying “weirdly” because everything works fine on the computer in my office, also on the computer at another lab but for some reason I get errors and experiment crashes when I try to run it on the computer at the lab I will be working on.
The first error can be seen below (I am accessing a sound stimuli in a folder and I get this error. If I produce a sound within PsychoPY though, it works. But it is not what I want to do) :
pygame 2.1.0 (SDL 2.0.16, Python 3.8.10)
Traceback (most recent call last):
Hello from the pygame community. Contribute - pygame wiki
0.8853 WARNING Monitor specification not found. Creating a temporary one…
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\sound\backend_ptb.py”, line 578, in stream
label, s = streams.getStream(sampleRate=self.sampleRate,
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\sound\backend_ptb.py”, line 139, in getStream
return self._getStream(sampleRate,
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\sound\backend_ptb.py”, line 178, in _getStream
raise SoundFormatError(
psychopy.exceptions.SoundFormatError: Tried to create audio stream 44100_2_128 but 48000_2_128 already exists and win32 doesn’t support multiple portaudio streams
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “C:\Users\kppadmin\Desktop\Metin\Metin_Paradigm_2\Metin_Paradigm_2_lastrun.py”, line 408, in
startle_hab = sound.Sound(‘stimuli/Study2_Audio_Startle.wav’, secs=-1, stereo=True, hamming=True,
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\sound\backend_ptb.py”, line 331, in init
self.setSound(value, secs=self.secs, octave=self.octave,
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\sound\backend_ptb.py”, line 426, in setSound
_SoundBase.setSound(self, value, secs, octave, hamming, log)
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\sound_base.py”, line 200, in setSound
self._setSndFromFile(p)
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\sound\backend_ptb.py”, line 459, in _setSndFromFile
self._setSndFromArray(sndArr)
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\sound\backend_ptb.py”, line 498, in _setSndFromArray
self.track = audio.Slave(self.stream.handle, data=self.sndArr,
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\sound\backend_ptb.py”, line 588, in stream
raise SoundFormatError(err)
psychopy.exceptions.SoundFormatError: Tried to create audio stream 44100_2_128 but 48000_2_128 already exists and win32 doesn’t support multiple portaudio streams
Another issue is that I have an excel coloumn where I define the duration of the sound component. And I index to these durations by, e.g. writing $duration_sound in the properties of my sound component (I put the $duration_sound in the duration field). Some duration values however are 0 because in some trials, I do not want the sound to be played. This works well in ohter computers as I said but in this computer, I get this error:
pygame 2.1.0 (SDL 2.0.16, Python 3.8.10)
Traceback (most recent call last):
File “C:\Users\kppadmin\Desktop\Metin\Metin_Paradigm_2\Metin_Paradigm_2_lastrun.py”, line 2716, in
startle_hab.setSound(‘A’, secs=duration_startle_hab, hamming=True)
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\sound\backend_ptb.py”, line 426, in setSound
_SoundBase.setSound(self, value, secs, octave, hamming, log)
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\sound_base.py”, line 183, in setSound
self._setSndFromNote(value.capitalize(), secs, octave,
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\sound_base.py”, line 222, in _setSndFromNote
self._setSndFromFreq(thisFreq, secs, hamming=hamming)
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\sound_base.py”, line 233, in _setSndFromFreq
outArr = numpy.arange(0.0, 1.0, 1.0 / nSamples)
ZeroDivisionError: float division by zero
Any ideas would be appreciated!