psychopy.org | Reference | Downloads | Github

Sound is played but distorted

Hello and thank you in advance for any answer you may provide for this problem !

To throw a little bit of context : I am coding an experiment using the coder and my stimuli consist of images and sounds. Until now, I managed to play sounds properly using the trialHandler in different experiments. Recently, I had to code another experiment wich displays both an image and a sound at the same time. Displaying images works fine but I cannot play sounds.

Let me explain myself. The sound I am refering to in the experiment (trail by trial) is not being played correctly (every trial, every run). What is played is similar to a “bass” white noise. However, I should hear a speech sound ([ba] in this case).
I have tried using different sound files but in the end does not change anything and the same noise comes out. Plus, in another experiment of mine, those sounds are played correctly without any problem.

When I ask to print the sound file played in the trial it shows the correct path.
I am kind of lost in this problem because a sound is still played every trial, just not the one expected and the sound played is not something I own in my files. Moreover, no error is found and the whole experiment works fine.

I am on Mac OS 10.8.5, latest version of psychopy to this date : 1.85.6.

Your help will be grealty appreciated !

I found the problem a while ago and it is a very stupid mistake…! If the sound is in a while loop and if you play the sound every time it loops, the sound’s very beginning will play again and again resulting in a ‘distorted’ sound which is, in fact, only the result of this phenomenon.

Hope it’ll help if someone encounters this problem !