psychopy.org | Reference | Downloads | Github

Some WAV files don’t play in full


#1

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.


#2

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.


#3

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.


#4

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 ISSUE HERE:
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 ‘…lastrun.py’ file) and run the experiment 10 times out of which it failed 6 times.

I’d appreciate any help! Thanks a lot!


#5

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.


#6

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.


#7

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.


#8

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.


#9

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).


#10

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?


#11

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?

Thanks!