# Trouble getting 3 sounds play at certain routines each. SoundFormatError

**URL:** <https://discourse.psychopy.org/t/trouble-getting-3-sounds-play-at-certain-routines-each-soundformaterror/22847>\
**Category:** Builder\
**Tags:** sound\
**Created:** [May 8, 2021, 6:06am UTC](https://discourse.psychopy.org/t/trouble-getting-3-sounds-play-at-certain-routines-each-soundformaterror/22847 "2021-05-08T06:06:22Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Maria\_Myrto\_Petratza](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/maria_myrto_petratza/32/13058_2.png) [@Maria\_Myrto\_Petratza](https://discourse.psychopy.org/u/Maria_Myrto_Petratza)\
**Post date:** [May 8, 2021, 6:06am UTC](https://discourse.psychopy.org/t/trouble-getting-3-sounds-play-at-certain-routines-each-soundformaterror/22847/1 "2021-05-08T06:06:23Z")

</div>

**OS** (e.g. Win10): Win10  
**PsychoPy version** (e.g. 1.84.x): PsychoPy 2021.1.2  
**Standard Standalone? (y/n)** yes  
**What are you trying to achieve?:**  
I am trying to create a digit span task, where the participants will see sequences of numbers, then have 20sec after each sequence to answer typing numbers with background music as a distractor. I need different pieces of music at trials 7-14, 15-21, then a different piece for trials 22-28

**What did you try to make it work?:**

> [@Loop allowing to display a music background during every routines of that loop](https://discourse.psychopy.org/t/loop-allowing-to-display-a-music-background-during-every-routines-of-that-loop/18585/4):
>
> Many thanks for your replies !! I managed to do something a bit betweeen both. If anyone else need it --\> : I inserted a routine at the beginning of my loop in which I added the sound component (let’s call him “sound\_1”) with no stop time and a code component in which I put in the Each Frame tab if t \>=0: sound\_1.pause() continueRoutine = False I had to this because between the 1st and the 2nd routine, the sound was starting from the beginning again woman_shrugging , which was not…

I used this solution adding routines with a sound component and a code component on the spots at the flow where I wanted the sound stimuli to start, and a code copmponent to the consecutive routines following (where I wanted the sound to be, for instance to routines 14-21) as is said to the solution I linked above.

**What specifically went wrong when you tried that?:**  
The experiment can’t be ran. However, it worked when I only had one sound.  
The message is:  
psychopy.exceptions.SoundFormatError: Tried to create audio stream 48000\_2\_128 but 44100\_2\_128 already exists and win32 doesn’t support multiple portaudio streams

##### Experiment ended.

I’m posting the whole traceback too:  
Traceback (most recent call last):  
File “C:\Users\User\Desktop\ΤΕΛΙΚΑ ΑΡΧΕΙΑ\EXPERIMENT\_COMPL\_lastrun.py”, line 772, in   
name=‘vocalfeeling’)  
File “C:\Program Files\PsychoPy3\lib\site-packages\psychopy\sound\backend\_sounddevice.py”, line 318, in **init**  
hamming=self.hamming)  
File “C:\Program Files\PsychoPy3\lib\site-packages\psychopy\sound\backend\_sounddevice.py”, line 373, in setSound  
raise err  
File “C:\Program Files\PsychoPy3\lib\site-packages\psychopy\sound\backend\_sounddevice.py”, line 365, in setSound  
blockSize=self.blockSize)  
File “C:\Program Files\PsychoPy3\lib\site-packages\psychopy\sound\backend\_sounddevice.py”, line 96, in getStream  
blockSize=blockSize)  
File “C:\Program Files\PsychoPy3\lib\site-packages\psychopy\sound\backend\_sounddevice.py”, line 135, in \_getStream  
.format(label, list(self.keys())[0], sys.platform)  
psychopy.exceptions.SoundFormatError: Tried to create audio stream 48000\_2\_128 but 44100\_2\_128 already exists and win32 doesn’t support multiple portaudio streams

##### Experiment ended.

Could somebody please help me figure this out? Many thanks in advance!

---

<div class="post-metadata">

**Author:** ![wakecarter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/wakecarter/32/5753_2.png) [@wakecarter](https://discourse.psychopy.org/u/wakecarter)\
**Post date:** [May 8, 2021, 6:15am UTC](https://discourse.psychopy.org/t/trouble-getting-3-sounds-play-at-certain-routines-each-soundformaterror/22847/2 "2021-05-08T06:15:54Z")

</div>

> [@Maria\_Myrto\_Petratza](#):
>
> Tried to create audio stream 48000\_2\_128 but 44100\_2\_128 already exists and win32 doesn’t support multiple portaudio streams

All of your sounds need to have the same bit rate. You can edit this in Audacity.

---

<div class="post-metadata">

**Author:** ![Maria\_Myrto\_Petratza](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/maria_myrto_petratza/32/13058_2.png) [@Maria\_Myrto\_Petratza](https://discourse.psychopy.org/u/Maria_Myrto_Petratza)\
**Post date:** [May 10, 2021, 10:52am UTC](https://discourse.psychopy.org/t/trouble-getting-3-sounds-play-at-certain-routines-each-soundformaterror/22847/3 "2021-05-10T10:52:01Z")

</div>

Thank you for the response! I’ve been trying this by the “save as” option, however in a .wav format there is no such option. Perhaps I’m doing something wrong. I’ll keep trying! Thanks again!

---

<div class="post-metadata">

**Author:** ![wakecarter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/wakecarter/32/5753_2.png) [@wakecarter](https://discourse.psychopy.org/u/wakecarter)\
**Post date:** [May 10, 2021, 10:59am UTC](https://discourse.psychopy.org/t/trouble-getting-3-sounds-play-at-certain-routines-each-soundformaterror/22847/4 "2021-05-10T10:59:17Z")

</div>

Try Tracks - Resample

---

<div class="post-metadata">

**Author:** ![Maria\_Myrto\_Petratza](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/maria_myrto_petratza/32/13058_2.png) [@Maria\_Myrto\_Petratza](https://discourse.psychopy.org/u/Maria_Myrto_Petratza)\
**Post date:** [May 23, 2021, 1:59pm UTC](https://discourse.psychopy.org/t/trouble-getting-3-sounds-play-at-certain-routines-each-soundformaterror/22847/5 "2021-05-23T13:59:14Z")

</div>

I fixed it by changing the Hz, choosing the same number for every track. Thank you so much!
