psychopy.org | Reference | Downloads | Github

Sound component not working on psychopy

I’m building a conditioning experiment with noise stimuli (3 noises in total: scratch, scream, and no sound [the no sound is a sound file itself]) using Psychopy. When I run the task, one of the noises (the scream) works while the other two cause the experiment to crash. They are all 1 second in duration .wav files and I have specified the files in the corresponding excel spreadsheet under the name ‘soundcontsound.’ In the sound component on the Builder view, I have specified the duration = 1.0s, the sound as $soundcontsound, and selected ‘set every repeat.’ The order of trials are as follows: a fixation toggled from 1000-1500ms > a visual cue for 2000ms > sound stimulus for 1000ms. At first, I thought the issue was related to lag of some kind, but I ran the task in which it played two of scream sounds in a row but then it crashed in the following scratch condition trial. Any insight on how to resolve this matter would be greatly appreciated. Thanks in advance!

SOLVED ISSUE: I changed the sampling rate of the files at 44100 Hz using an audio changer and now it’s working on the psychopy builder. Thanks everyone for your responses.

Do you get an error or a warning in the Runner stdout?

Are you running this locally or online?

Yes. Warning message below.

Welcome to PsychoPy3!
v2020.2.4
143.0243 INFO Loaded monitor calibration from [‘2020_10_23 15:33’]
206.4050 EXP Imported D:\psychopy_devaluation\devalue_cond.xlsx as conditions, 45 conditions, 5 params
Generating PsychoPy script…

####### Running: D:\psychopy_devaluation\aversive_devaluation_lastrun.py #######
25210.3911 INFO Loaded monitor calibration from [‘2020_10_23 15:33’]
pygame 1.9.6
Hello from the pygame community. https://www.pygame.org/contribute.html
0.7523 WARNING We strongly recommend you activate the PTB sound engine in PsychoPy prefs as the preferred audio engine. Its timing is vastly superior. Your prefs are currently set to use [‘sounddevice’, ‘PTB’, ‘pyo’, ‘pygame’] (in that order).
6.2645 WARNING User requested fullscreen with size [1024 768], but screen is actually [1920, 1080]. Using actual size
10.2560 WARNING Couldn’t measure a consistent frame rate.

  • Is your graphics card set to sync to vertical blank?
  • Are you running other proc

This happened locally but will be running online once fixed.

If you’re planning to run you study online, I think you should try to test the JavaScript code from the beginning. The back end of the PsychoJS sound module is entirely different from the PsychoPy sound module and you might have errors with the JavaScript version that you don’t get running with Python.

That being said, I don’t see why your script would crash the way you ran it because your output shows no error. Warnings don’t cause an experiment to crash.

1 Like