Unexpected error occurred while running the experiment
I am making an experiment for an assignment and there are 3 audio files that are included in it which are present before each task, so if i use only one file the experiment runs fine but when i use all 3 files it shows unexpected error occurred.
also do note i have no knowledge of python script. This is the error
Error: UnexpectedError
An unexpected error occurred while running the experiment
Traceback (most recent call last):
File "C:\Program Files (x86)\OpenSesame\Lib\site-packages\libqtopensesame\misc\process.py", line 132, in run
exp.run()
File "C:\Program Files (x86)\OpenSesame\Lib\site-packages\libopensesame\experiment.py", line 351, in run
self.items.execute(self.var.start)
File "C:\Program Files (x86)\OpenSesame\Lib\site-packages\libopensesame\item_store.py", line 88, in execute
self.prepare(name)
File "C:\Program Files (x86)\OpenSesame\Lib\site-packages\libopensesame\item_store.py", line 122, in prepare
self[name].prepare()
File "C:\Program Files (x86)\OpenSesame\Lib\site-packages\libopensesame\sequence.py", line 88, in prepare
self.experiment.items.prepare(_item)
File "C:\Program Files (x86)\OpenSesame\Lib\site-packages\libopensesame\item_store.py", line 122, in prepare
self[name].prepare()
File "C:\Program Files (x86)\OpenSesame\Lib\site-packages\libopensesame\sampler.py", line 69, in prepare
self.sampler = OpenExpSampler(self.experiment, sample)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files (x86)\OpenSesame\Lib\site-packages\openexp\sampler.py", line 36, in Sampler
return cls(experiment, *arglist, **kwdict)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files (x86)\OpenSesame\Lib\site-packages\openexp\_sampler\psycho.py", line 84, in __init__
self._sound = Sound(self._data, sampleRate=self._samplerate, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files (x86)\OpenSesame\Lib\site-packages\psychopy_sounddevice\backend_sounddevice.py", line 328, in __init__
self.setSound(value, secs=self.secs, octave=self.octave,
File "C:\Program Files (x86)\OpenSesame\Lib\site-packages\psychopy_sounddevice\backend_sounddevice.py", line 392, in setSound
raise err
File "C:\Program Files (x86)\OpenSesame\Lib\site-packages\psychopy_sounddevice\backend_sounddevice.py", line 382, in setSound
label, s = streams.getStream(sampleRate=self.sampleRate,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files (x86)\OpenSesame\Lib\site-packages\psychopy_sounddevice\backend_sounddevice.py", line 97, in getStream
return self._getStream(sampleRate,
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files (x86)\OpenSesame\Lib\site-packages\psychopy_sounddevice\backend_sounddevice.py", line 135, in _getStream
raise SoundFormatError(
psychopy.exceptions.SoundFormatError: Tried to create audio stream 16000_2_256 but 44100_2_256 already exists and win32 doesn't support multiple portaudio streams
Comments
Hi @amreenshaikh,
This error is most likely occurring because PsychoPy (the backend I assume you are using) does not support multiple audio streams with different sample rates in the same experiment. If your first audio file has a sample rate of 44.1 kHz and another has 16 kHz, this will cause a crash.
To fix this, make sure all your audio files have the same sample rate (frequency) before adding them to your experiment. You can use a tool like Audacity to convert them.
Hope this helps,
Claire
Check out SigmundAI.eu for our OpenSesame AI assistant! 🤖