| Reference | Downloads | Github

Issues finding audio resources + sampling rate error (previously posted solutions fail)

URL of experiment:

Version of PsychoPy used: 2020.2.8

Description of the problem: The experiment is having trouble finding the auditory stimuli located in the resources folder. When I use the full path (on a local run, pointing to the exact folder), I get the following error:

“psychopy.exceptions.SoundFormatError: Tried to create audio stream 22050_2_128 but 44100_2_128 already exists and win32 doesn’t support multiple portaudio streams”.

I have checked each audio file in Audacity and they all have the same Sampling Rate (22050 Hz), though there WERE sampling rate conflicts before (they have all been fixed though).

The experiment is an auditory recognition task where participants will listen to a sequence of sounds, and the be asked to choose which sound, out of two presented to them after the main sequence, they heard. This is run on a loop, with stimuli for each audio segment read from a .csv file. (I have previously had this experiment work fine. The addition of the secondary audio files is when it started going wrong).

Desired outcomes:

  • For the experiment to run! I have checked every audio file that is being read into the experiment and they are all sampled at the same rate. Is there any other fix I can try?

  • I also want to set up a relative file path (something like /stim/{filename}.wav) to run my experiment locally, so the transition online is easier, but it does not recognize the relative path when I use it. It requires the full path.

Fixes I have tried:

  • changing the slashes for the path (from \stim\{filename}.wav to \stim{filename}.wav to /stim/{filename}.wav)
  • Changed ‘stim’ folder to ‘resources’ folder (one wasn’t auto-generated for me). Previous iterations of the experiment have run from the stim folder, so I don’t think this is the issue…
  • Changing .wav files to .mp3 (PsychoPy doesn’t recognize the mp3 files for some reason when I run it locally, so I’ve kept them as .wav)

I have read and implemented multiple solutions on other similar topics posted, but they haven’t worked or are, I feel, not applicable to my experiment. (I may be wrong). Any help is appreciated, thank you!

Update: I managed to figure out the path issue (I guess I didn’t need the extra forward slash…so changing ‘/resources/{filename}’ to ‘resources/{filename}’ made a difference).

I’m still trying to trouble shoot the sampling rate. Again, the files themselves are all at the same sampling rate. Might there be some metadata that’s conflicting that causes PsychoPy to spit out the following error at me?

psychopy.exceptions.SoundFormatError: Tried to create audio stream 22050_2_128 but 44100_2_128 already exists and win32 doesn’t support multiple portaudio streams

More information: My Audio latency priority is set to ‘3: Aggressive low-latency’, and my Audio Library is set to ‘sounddevice’ (my laptop doesn’t work with PTB).

Final update: the sampling rate error was due to a sound driver issue, not the files. So using ‘pygame’ helped resolve that issue.