Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

Sampler sound file variable error

edited December 2024 in OpenSesame

Hi, I am currently working on an experiment in which the different sounds are presented to the participant in each iteration of a loop. For some reason I get a system error when trying to get the name of the file from the loop but it runs fine if I input the file name specifically.

I have tried to run this both from the temp folder the experiment creates and from the hosting folder on two different systems with the same result.


I would appreciate any help you can offer.


Jordan.


Here is the error report:


Traceback (most recent call last):
  File "D:\OpenSesame\Lib\site-packages\libqtopensesame\misc\process.py", line 132, in run
    exp.run()
  File "D:\OpenSesame\Lib\site-packages\libopensesame\experiment.py", line 351, in run
    self.items.execute(self.var.start)
  File "D:\OpenSesame\Lib\site-packages\libopensesame\item_store.py", line 89, in execute
    self.run(name)
  File "D:\OpenSesame\Lib\site-packages\libopensesame\item_store.py", line 105, in run
    self[name].run()
  File "D:\OpenSesame\Lib\site-packages\libopensesame\sequence.py", line 48, in run
    self.experiment.items.run(_item)
  File "D:\OpenSesame\Lib\site-packages\libopensesame\item_store.py", line 105, in run
    self[name].run()
  File "D:\OpenSesame\Lib\site-packages\libopensesame\loop.py", line 347, in run
    self.experiment.items.execute(self._item)
  File "D:\OpenSesame\Lib\site-packages\libopensesame\item_store.py", line 88, in execute
    self.prepare(name)
  File "D:\OpenSesame\Lib\site-packages\libopensesame\item_store.py", line 122, in prepare
    self[name].prepare()
  File "D:\OpenSesame\Lib\site-packages\libopensesame\sequence.py", line 88, in prepare
    self.experiment.items.prepare(_item)
  File "D:\OpenSesame\Lib\site-packages\libopensesame\item_store.py", line 122, in prepare
    self[name].prepare()
  File "D:\OpenSesame\Lib\site-packages\libopensesame\sampler.py", line 69, in prepare
    self.sampler = OpenExpSampler(self.experiment, sample)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\OpenSesame\Lib\site-packages\openexp\sampler.py", line 36, in Sampler
    return cls(experiment, *arglist, **kwdict)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\OpenSesame\Lib\site-packages\openexp\_sampler\psycho.py", line 72, in __init__
    self._data, self._samplerate = sf.read(src)
                                   ^^^^^^^^^^^^
  File "D:\OpenSesame\Lib\site-packages\soundfile.py", line 285, in read
    with SoundFile(file, 'r', samplerate, channels,
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\OpenSesame\Lib\site-packages\soundfile.py", line 658, in __init__
    self._file = self._open(file, mode_int, closefd)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\OpenSesame\Lib\site-packages\soundfile.py", line 1216, in _open
    raise LibsndfileError(err, prefix="Error opening {0!r}: ".format(self.name))
soundfile.LibsndfileError: Error opening 'S1_C.mp3': System error.

Comments

  • Hi Jordan,

    Could you also provide the code that you use?

    Eduard

    Buy Me A Coffee

  • Sure,


    Here is a condensed version ( the original version has a lot more soundfiles attached but the error persists in this version)

    Thanks for the help!


    Jordan.

  • Hi,

    You can try this suggestion: https://github.com/bastibe/python-soundfile/issues/380

    If not, they say that this problem most commonly originates from an incorrect file path. To be honest, I couldn't make it work, during the few attempts that I just gave them.

    Alternatively, you can try converting the files to another format. Ogg for example.

    Maybe that helps,

    Eduard

    Buy Me A Coffee

  • edited December 2024

    Hi Eduard, thanks for the response.


    I found the culprit, some of the file names had hidden Unicode characters. Worth noting the for the future that when a variable is holding a file name such as in this case this issue can arise.

    Thanks.


    edit: spelling.

Sign In or Register to comment.