psychopy.org | Reference | Downloads | Github

Error with sound set volume

PsychoPy version (2021.2.3):
**Standard Standalone? y
What are you trying to achieve?: play sound file in main trials. It all works in the practice block but not in the main block. The settings are exactly the same, but I have made sure variable names are different in the trial block and the main block.

What did you try to make it work?:
change the audio preferences to ptb but then the sound file is compressed (playing too fast), so I am using pygame, which works well for the practice trials.

I have also tried to type in the volume again (1) but that didn’t help.
Error message and screen shots attached.
thanks a lot for helping me!

Error message:
File “C:\Users\yf903040\Documents\CSFT psychopy\CSFT_2508txtfinal2_lastrun.py”, line 753, in
sound_2.setVolume(1.0, log=False)
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\sound\backend_pygame.py”, line 268, in setVolume
self._snd.set_volume(newVol)
AttributeError: ‘NoneType’ object has no attribute ‘set_volume’

Experiment

Processing: error_sound.docx…
image
image

Hi There,

I am having trouble replicating the error my side on a windows 10 (what operating system are you on?)

Please could you share with us a minimally working demo of the bug?
Thanks,
Becca

Thank you so much for looking into this for me. I don’t know how to attach the bug issue (apart from the error message I have already shared), but have now attached the experiment, which I hope you can open, as well as the two conditions files (one for the practice round and one for the main experiment), and then two sound files.
Thanks ever so much for looking into this.
all best
Jeanine
CSFT_2508txtfinal2.psyexp (54.6 KB)
conditions_Main.xlsx (15.0 KB)
conditions_practice2.xlsx (10.5 KB)

I am on Windows 10

I have exactly the same problem. Three month ago everything worked fine.
I’m using PsychoPy v2021.1.2.
A single audio file is played in the main trials, then the error message appears.

I would be very grateful for quick help. Could the problem be related to JavaScript version? I work on a laptop managed by the university (Windows 10) and maybe an update or something similar has changed something?

Hi There,

Thanks for sharing these - in terms of attaching a “minimally working bug” I mean - please could you try striping back the experiment so that it is only the routine and loop where the issue is occurring (that makes it much faster for us to offer support rather than running the whole experiment)

I tried running the files you sent on there and am missing a resource “record_pract/04.wav” (if you could please share a stripped back version with the files that would be needed to run it that would be helpful - thank-you!
Becca

thanks very much indeed - I hope I have done the right thing by leaving out the welcome messages and explanations.
It is basically an experiment where listeners have to evaluate bilingual stimuli on a slider (on a scale from 0-100).

CSFT_shortened.psyexp (54.4 KB)





Files 1 to 6 are the sound files for the practice round and the other files (93-98) are part of the main block





![98|audio](upload://fs9neGaVgKzJQVd3FuE33oTSDTT.Wpicture of files

I have attached a few sound files from the main block. The files for the practice round are in a folder called “record_pract” and those for the main block are in a folder called “recordings”, as indicated in the conditions files.

I cannot upload the entire folders with the sound files, as the system won’t allow me to upload a zip file. I hope this gives enough information?
Thanks ever so much for your help.
best wishes
Jeanine

conditions_practice2.xlsx (10.5 KB)
conditions_Main.xlsx (15.0 KB)

Hi Becca
Could you or a colleague perhaps look at my issue? I am hoping to start data collection soon.
thanks very much indeed for your help.
best wishes
Jeanine

Dear all
I still haven’t heard back. Is anyone able to help?

Hi There,

For the benefit of the forum we found the solution to this - ensure that all files have the same sampling rate and format (we converted all files to wav files with 44100 sampling rate using ffmpeg - can be done in audacity if you have fewer files).

Becca

I solved the problem. It was a version problem. The newest version gave the message that the experiment should run with the version in which it was programmed. Strangely enough, a version that was not the latest, but also not the one in which the experiment was programmed, could not bring this error message, but gave messages about alleged errors that did not actually exist. In addition, this experiment ran fine some time ago … So I think it has something to do with updates.