# Issues with the sound component

**URL:** <https://discourse.psychopy.org/t/issues-with-the-sound-component/30342>\
**Category:** Builder\
**Created:** [August 9, 2022, 1:39pm UTC](https://discourse.psychopy.org/t/issues-with-the-sound-component/30342 "2022-08-09T13:39:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![grimfandangosh](https://avatars.discourse-cdn.com/v4/letter/g/67e7ee/32.png) [@grimfandangosh](https://discourse.psychopy.org/u/grimfandangosh)\
**Post date:** [August 9, 2022, 1:39pm UTC](https://discourse.psychopy.org/t/issues-with-the-sound-component/30342/1 "2022-08-09T13:39:56Z")

</div>

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](https://www.pygame.org/contribute.html)  
> 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!
