psychopy.org | Reference | Downloads | Github

Wav file issue in Safari

Hi,

I’m encountering an issue with an experiment on pavlovia that previously worked fine in Safari (PsychoPy 2020.2). I’m now using PsychoPy 2020.2.4 and the error that I get in Safari is “unable to download resource: break.wav (No codec support for selected audio sources.)”. break.wav is an uncompressed wav file (16bit, 44.1Khz). Error does not occur in Chrome, Edge or Firefox. Any idea how to fix the wav file issue in Safari?

Thanks,

Walter

1 Like

Hello,

use a different format (e.g., .mp3). wav is a windows format.

Cheers Jens

Hi,

Is there a reason that it used to work in Safari and now it does not? The experiment I was trying to run just a few weeks ago worked perfectly with our wav files but it no longer can. Was there an update to pavlovia or was it a safari update? Thank you!

-Thomas

Not sure if it’s only a wav file issue. I replaced all wav files with mp3 (unfortunately losing audio quality) and got the following error in Safari:

edit: it’s also impossible to run the example of Tone.Player in Safari

I am wondering if you found a solution to this? I have encountered the same problem, and I am using wav because mp3s caused different errors…! The wav files work for me on most browsers but not Safari.

Dear @slaterjess, @DanielKuroschHopfner, @ThomasY, @walter, @JensBoelte thanks for flagging. As it happens updating howler.js, one of the audio libraries PsychoJS relies on, is all it takes in this case and the fix has already made it into PsychoPy master. Without upgrading your PsychoPy installation, you can also edit 'index.html in your project to load in howler.js v2.2.1 as shown in the respective PR. Please let me know if you need more details, s.

This worked, thanks!!

Hi! i am facing the same issue with my wav files. what exactly should i do to solve this?
my version is 2020.2.10

Thanks!

Hi @chayabenyehuda, just howler.js needs upgrading and for that you can edit ‘index.html’ in your project root replacing line 27 with the following:

<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/howler/2.2.1/howler.min.js"></script>
1 Like

thank @sotiri ! it works now!

Hi @sotiri,

Unfortunately, the updated howler.js doesn’t fixed issues with that I have with .wav files.

On Safari I get the error " * unable to download resource: audio/push.wav (No codec support for selected audio sources.). All .wav files are identical and play fine in PsychoPy.

With Firefox I just hear a very loud beep when the .wav sound should be played.

Hi @walter, please would it be possible to give me access to your project so I can take a closer look? Thanks, s.

Issue with .wav files on Firefox is solved by setting the duration of the sound. In PsychoPy the sound plays fine when the duration is not entered. However, on pavlovia it is crucial to set the duration.

Unfortunately, setting the duration using a variable (e.g., ‘thePhonemeDuration’) does not work…

  File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/experiment/components/sound/__init__.py”, line 91, in writeInitCode
ValueError: could not convert string to float: ‘thePhonemeDuration’

Hello Walter

the variable thePhonemeDuration seems to be a string. However, duration should be a float :wink:

Best wishes Jens

Hi @JensBoelte, I’ve converted thePhonemeDuration to float but that didn’t fix the problem

Hello Walter,

try this

PhonemDuration.psyexp (7.4 KB)

Best wishes Jens

Audio works now in Firefox by not specifying the audio duration. However, this requires another component with a fixed or dynamic duration in order to end the routine. Transition to next routine is not smooth. I guess integrating this routine with the next is the only solution.

Hi @JensBoelte, Thanks that works. I tried that earlier but then it didn’t work, no idea why. It seems some fields allow variables without typing ‘$’ before the variable and that was the issue. I’ve now checked that all variables in the fields start with ‘$’ and that solves the issues with durations. Thanks.