psychopy.org | Reference | Downloads | Github

Distorted sounds offline experiment

OS Win10
PsychoPy version v2020.1.3
I am conducting an experiment where participants listen to sounds (people’s voices), and they need to make some judgments on the voices. I used Psychopy2 to build my experiment (from the builder with lots of additional code components), and the sounds played perfectly fine at the time. However, when I change to the newest version of Psychopy3, for some reason, the sounds are distorted.
The original sound files played normally in the media app, so I don’t really know what happened. I looked up the settings, and see that the audio library is set to be pbt (when I used Psychopy2, I used pyo), so I tried to change to different libraries but it’s either crashing my experiment or making the sound distorted.

Original file:

Recorded distorted file:

If you look at the experiment in Coder view, what are the parameters when the noise component is created? It should look something like this:

noise = visual.NoiseStim(
                                    win=win, name='noise',units='pix', 
                                    noiseImage='testImg.jpg', mask='circle',
                                    ori=1.0, pos=(0, 0), size=(512, 512), sf=None, phase=0,
                                    color=[1,1,1], colorSpace='rgb', opacity=1, blendmode='add', contrast=1.0,
                                    texRes=512, filter='None', imageComponent='Phase'
                                    noiseType='Gabor', noiseElementSize=4, noiseBaseSf=32.0/512,
                                    noiseBW=1.0, noiseBWO=30, noiseFractalPower=-1,noiseFilterLower=3/512, noiseFilterUpper=8.0/512.0, 
                                    noiseFilterOrder=3.0, noiseClip=3.0, filter=False, interpolate=False, depth=-1.0)

It sounds like there’s some kind of filter being applied, or it’s incorrectly interpreting the frequency of the file, so if you post the equivalent code then I can try to recreate the bug and see what’s going wrong.

Hi,
I have the same issue. How can I fix it easily? I did not find the parameters in Coder view that you suggested.

I took a screen shot to show you what parameters I got in Coder view.

Thanks.
Zehra

P.S. Do you think delete/re-install the PsychoPy would help?

Oops, this was a rookie mistake on my part, I’d got NoiseStim mixed up with SoundStim…

It looks like you’re opening the .psyexp file in coder, try instead opening it normally and clicking the Compile Python :compile_py: button to see the experiment as code, do you see any reference to sound.Sound? You can use CTRL+F to search

Thank you for your reply @TParsons and for telling me the shortcut.

Yes, I found that and looks fine to me. I do not know what I have done? Probably I changed something with accident.

I have attached the screenshot. Could you please take a look at that and let me know what is wrong?

Many thanks.
Best,
Zehra

The code looks fine to me, what audio settings do you have in Preferences?

audio library: PTB, pyo, sounddevice, pygame…
audio latency mode: 3: Aggressive low-latency
audio driver: coreaudio, portaudio
audio device: Built-in Output
parallel ports: 0x0378, 0x03BC,/dev/port0,/dev/parport1
Qmix configuration: qmix_confic

Sounds like the sample rate is not be correctly set for the audio. However, I’m not quite sure what’s happening here, need to look into it.

This might be related to what I just posted here on an older issue

1 Like