URL of experiment: https://pavlovia.org/anthonycruz202/soundcat
Description of the problem: I have two sound stimuli that are set to play at the same time, for the same duration, at different volumes during “practice” and “test” routines. The same issue happens in both routines: The high-volume sounds (high_amp_prac and high_amp_test) are set in PsychoPy Builder to play at Volume 2 while the low-volume sounds (low_amp_prac and low_amp_test) are set to play at Volume 1. This works perfectly when I run the program locally, but it does not work when I run the program on Pavlovia. Looking at the .log files, it looks like both sounds play at Volume 1 no matter what. Is there any way for me to fix this?
It looks like the sound module in psychoJS takes a volume value between 0 and 1 (https://psychopy.github.io/psychojs/module-sound.Sound.html) have you tried using two volume values that fall in that range?
So I just had a go replicating this, but setting one sound to be 0.5 and the other to be 1 and the volumes appear OK online for my demo (but it uses wav files) Here is a link to that https://gitlab.pavlovia.org/lpxrh6/doublevolcheck
I had a fork of your task (you should be able to see the edits I tried in my fork) and I am not sure the volume is the issue, changing the volume of the low amp from 0.5 to 0.7 audibly alters the sound as expected. However, the frequencies sound slightly different locally to online, is it possible that this is the issue rather than the volume? or have you had a printout of the vol?
cool task by the way! incase this is an issue with version I am also running psychopy version 2020.2.4
Thank you! We’re using the same version of PsychoPy it seems. I’m sure it’s the volume that’s the issue because in the .log files output when I run on Pavlovia, I get the following lines:
||Created TonePlayer = TonePlayer( name=TonePlayer, note=1204.9969966624908, duration_s=0.3, volume=1, loops=null, soundLibrary=“TONE_JS”, autoLog=true )
||Created TonePlayer = TonePlayer( name=TonePlayer, note=741.4147867786816, duration_s=0.3, volume=1, loops=null, soundLibrary=“TONE_JS”, autoLog=true )
So it seems that both tones are generated with the same volume, these snippets appear all throughout the log file where I would expect to see the tones being played.
Ok I see! So, interestingly, if we use console.log(low_amp_prac.volume) that does print out the correct volume in the console online (suggesting that the volume is being set correctly).
For the log file, I am sensing that line actually refers to the initialisation of toneplayer (https://psychopy.github.io/psychojs/module-sound.TonePlayer.html),which actually receives the sound created in sound.sound (https://psychopy.github.io/psychojs/module-sound.Sound.html), so I think the volume is set in advance of the toneplayer, but I see how this is confusing. Let me ask check my understanding with some of the JS folk. @thomas_pronk @sotiri would my interpretation of how sound and toneplayer interact be accurate?
@WelcomeToCruztown @Becca @thomas_pronk No problem, let me take a look, thanks for flagging, x
I think the volume is fine and it being set correctly - but I just don’t know enough about how toneplayer interacts with sound and why it would read volume as 1
@Becca is right @WelcomeToCruztown, the log entries you point to reflect the default settings the moment the player object is instantiated. Further down the log file you can see the actual playback volume is different, e.g., https://gitlab.pavlovia.org/support/soundcat/blob/master/data/75332648_soundCat_2020-10-20_21h21.16.557.log#L59. Hope that helps some, please let me know if you need more support, x
thanks for clarifying that @sotiri !!!
Thank you both! @sotiri @Becca