Random loud crackling noise with sound stimuli

I’m experiencing a loud crackling and distorted sound presentation in my study stimuli. It only happens half the time–the other half of the time, the sound is perfect. My sound files are all .wav and super tiny in size.

Example code is below, and I’m running Mac OS 10.15.4 on a new Macbook Pro and Psychpy 2020.1.2.

for frameN in range(360):
        if frameN == 0:
            nextFlip = win.getFutureFlipTime(clock='ptb') 
        elif 1 <= frameN <= 41:
        elif 42 <= frameN <= 71:
        elif 72 <= frameN <= 113:
        elif 114 <= frameN <= 143:
        elif 144 <= frameN <= 185:
            if frameN == 180: # 3000ms after onset of face-voice pair
                nextFlip = win.getFutureFlipTime(clock='ptb')
        elif 186 <= frameN <= 215:
        elif 216 <= frameN <= 257:
        elif 258 <= frameN <= 287: 
        elif 288 <= frameN <= 329:
        elif 330 <= frameN:

Thanks in advance for any guidance!


I am no expert on this topic, but what you’re doing in this loop could still be resource intensive, even if your wav file is small. Are your emotion_face_object images large? Did you try whether you get the same effect on a PC with a better graphics card and/or better sound card?

What is the length of your sound? Could there be overlap between the emotion_voice_object and the startle_probe_object at some point?

As I say, I’m no expert - these things could play no role whatsoever.

Thanks LukasPsy for your suggestions! The emotion_face_object images are about 350 kb, so I don’t think their size should be an issue.

Yes, there is overlap between the emotion_voice_object and the startle_probe_object. The idea is that, while the emotion_voice_object is playing for 6000ms, the startle_probe_object is briefly presented for 50ms.

Is it a problem if sound files overlap in Psychopy?

I don’t know, but maybe you could test just that? Make it so that the audio presentations don’t overlap and try to reproduce your crackling sound.

Maybe someone else who reads this knows more about ptb? :thinking:

I hear swift crackling sound and poping sound when audio file terminated by response locally on my mac. doesn’t have issue this when running online tho.

i just heard the same kind of crackling playing sound with praat… at least in my case, it seems to be a problem with my mac not psychopy