Some WAV files don’t play in full

OS (e.g. Win10): Windows 10
PsychoPy version (e.g. 1.84.x): 1.90.2
**Standard Standalone? Yes

I am trying to play some sound clips (up to 2 seconds long) for a perception experiment. But, some files are getting clipped and are not being played in full.

Based on a previous discussion here (Coding), I tried building the experiment from scratch, but the issue remains.

Any help appreciated. Thanks.

Hello everyone,

I am still frantically looking for a solution! I have tried writing from scratch multiple times; tried writing in different versions of PsychoPy, but of no help!

I would really really appreciate if anyone could give me any idea what’s happening.

Help us to help you. Provide more detail of what you are doing. Show how you are specifying the duration of your routines and sound components. Include some screen shots. At the moment there isn’t enough information to give you a useful response.

I am sorry for the lack of information. Here are some more details:

This is the main flow of the experiment. In the trial routine, all the components start at 0.5 sec.

In the trial, I am trying to play five .wav files of the following durations:

  • 5.04 sec, 5.40 sec, 1.52 sec, 1.57 sec, and 1.48 sec

Here are the properties of the sound component in the trial routine:

I kept the Stop (duration) field black so that all the sounds are played in full. [The Stop (duration) in components “text_3” and “key_resp_3” are also blank.]

The value “$sounds” in Sound field is the column title of the sound names in the conditions file.

The problem I am facing is that “most of the times” I run the experiment the longer files don’t play in full (though the short ones play ok). It sounds like only the first 1 or 1.5 seconds are played and the rest is silence for that sound. The experiment, however, runs in full; each of the sounds is being attempted, as expected.

The reason I am saying it happens “most of the times” is that, the sounds play fine sometimes. For example, I ran it five times, and it worked fine in 1 or 2 runs. I tried to restart PsychoPy before each run (and manually remove the ‘…’ file) and run the experiment 10 times out of which it failed 6 times.

I’d appreciate any help! Thanks a lot!

OK, that setup looks correct. I could suggest an optimisation, but I don’t know that it would fix your problems. A sound component with a varying sound file generally loads that file at the start time of the component. That can lead to some lag, as this takes some finite time (depending on the speed of disk, size of the file, etc). But you conveniently have a 0.5 s blank period at the start of each trial, and can load the files then. To do this, insert a “static period” component (under the “custom” arrow in the components panel).

A static period doesn’t actually do anything itself but is an indicator to Builder that nothing is changing during this period. Set its duration to be from 0 to 0.5 seconds. In your sound compoenent, switch from specifying the sound file on every routine to instead be during the name of that static period.

This should reduce the playing lag of your sound. Not sure if it will improve the other issues, but give it a go.

1 Like

Thanks for your quick reply. I am, in fact, not sure I got this line “In your sound compoenent, switch from specifying the sound file on every routine to instead be during the name of that static period.”

So, the “$sounds” value in the Sound subfield refer to the columns in my ‘conditions.xlsx’ file containing the names of individual .wav files. Are you suggesting doing something else? Sorry I am just a beginner user of PsychoPy.

That doesn’t change. But next to that field is the pop-up menu that allows you to specify when the sound file is updated. Presumably it currently says “every repeat”. But now that you’ve inserted a static period, there will be a new option in that menu, which contains the name of the static period. Select that instead. A new sound file will still be assigned on each routine, but now it will happen 500 ms earlier.

1 Like

Thanks for the explanation! I tried it, but, unfortunately, the issue still persists. The sounds are still getting clipped after about 1.5 seconds.

Could there be any issue with my system itself; I’ll, maybe, try it on another machine and post updates. Meanwhile, I’ll appreciate any other suggestions. Thanks.

A very general suggestion is to go into PsychoPy’s preferences and try changing the order of the audio libraries (the first in the list is the one that gets run by default).


I’ve just taken an experiment using audio files, which was working perfectly in PsychoPy 2. I’ve built the exact same version in PsychoPy3 and now the sound files are cutting out in the middle, just as the @jahirju30 mentioned.

I’be tried the various fixes that @Michael suggested. But, none have stopped the files from cutting out. When I tried to set an ISI and have audio files load during the 2 second ISI, the experiment wouldn’t even run.

Not sure how to solve this. It seems like this only happens in PsychoPy3.

Any suggestions?

Hi @unagi_pie. Did you ever manage to solve the issue with the WAV files? I am having the exact same problem. I am trying to run an experiment designed with Psychopy2 (v. 1.83.01) using Psychopy3 and my sounds get cut out towards the end. All sounds are between 500 ms and 1200 ms long and it’s only the longer ones that get cut. Is there any way to fix that?


I have the same problem. The audio files are not same in length in my experiment and some audio files can not be played completely (i.e., clipped midway). The solution @Michael provided worked perfectly for me. That is to insert a static component ahead of the sound component in order for the audio files to preload, as displayed in the picture.

1 Like

I had the same problem and tried different ISI values for hours. It helped at first, but not if the sound files is longer than 1 sec. But then I took Michael’s other advice and changed the order of the audio libraries and that seemed to have fixed the issue! Thank you :slight_smile:

As Inma, I changed the order of the audio libraries : [‘pygame’, ‘pyo’, ‘sounddevice’, ] and it worked. I also had sounds of different length (sometimes more than 1sec).

This solution worked for me. Thank you, Michael!

I am having the same problem actually using the latest version of PsychoPy—did you manage to solve the problem in the end and if yes, how?

Thank you so much in advance for helping!

@ening this is still a problem in Builder as far as I know, but if you are planning on going online, the online version is not affected. I would try it out in your browser and see if it works. However, if you’re not going online, that’s another story.