psychopy.org | Reference | Downloads | Github

No constant sound volume for files (bug?)

Hi,

I’ve encountered a problem with the volume in PsychoPy Builder 1.90.2 sound components. If I set the volume to, say, 0.8 and “constant”, I would expect the same absolute sound volume for each trial in a loop. This works well for frequencies (e.g., 440) and notes (e.g., A). However, if I use a wave file for the sound, the volume seems to be treated as relative - it decreases with each trial (probably 0.8 ^ trialN). This is independent of the constant/set every repeat/set every frame setting. Is this behavior intended?

I have attached a minimal example demonstrating the problem.

Best regards
Torge

https://aws1.discourse-cdn.com/business7/uploads/psychopy/original/2X/c/cb93448fd82345db900a4ac8ede7c47ac47aa10a.wav Volume_not_constant.psyexp (3.5 KB)

Hi @TorgeMS, I have run your experiment with Psychopy 3, and version 1.90.2 from Psychopy 3 (with useVersion function), and I am unable to recreate the error. Do you have any other information, for example can you print the value of the volume on each trial? e.g., print(sound_1.volume)

Thanks for your reply!
Using a text component with $sound_1.volume “set every repeat” or a code component with print(sound_1.volume) in “Begin Routine” returns 0.8 for each trial, as it should be. Strange.
My audio library is set to [u'sounddevice', u'pyo', u'pygame', ] and I’m working on Windows 7, by the way.

A similar bug is happening to me. I’m on:

  • Windows 10
  • Psychopy 3.0
  • audio library: [‘sounddevice’, ‘pyo’, ‘pygame’, ]
  • audio driver: [‘Primary Sound’, ‘ASIO’, ‘Audigy’, ]

I have a custom .wav sound that I start playing at the beginning of every trial, goes on throughout the trial (~10-15 secs), and then I stop at the end of the trial, with constant volume of 0.8. Throughout the trial I also have other shorter sounds from time to time (duration of < 1 sec each). What seems to be happening is that the volume of the custom .wav sound seems to decrease (linearly?) on every trial, so that by trial 30 circa, it’s not hearable anymore. This behavior is also very inconsistent, as sometimes towards the end of a trial, the volume will suddenly rise again to a normal volume level, for a few seconds.

I’m really not sure what’s going on here!

I would also like to add that switching to using Pyo instead of Sounddevice fixed this problem for me. So it’s almost surely related to Sounddevice.