Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

Variable volume in OSWeb sampler / file pool URL

Hi,

I'd like to have a loop at the beginning of an experiment where the participant can adjust the volume to their liking, then have this applied to all samples. My idea is to set an initial value for volume in vars, then the participant can adjust this up and down via keypresses, playing a test sound in between for feedback.

This volume value will then be applied to all subsequent samples.

I created an experiment with an inline_javascript containing only

vars.vol = 0.5;

in the Prepare tab and a sampler with an example WAV file and changed

set volume "[vol]"

in the script view.

This pops up an alert "TypeError: console.warning is not a function"

Going into the console and tracking down the error, the code for this is:

console.warning("Unable to apply volume or gain",t)

As a workaround I looked at adding an audio element to the page using inline_javascript, but got stuck on trying to find the URL for the sound file in the file pool. (That's not essential of course, it could be hosted elsewhere, but it would be nice to keep it with the rest of the experiment).

So, it would be great if anyone had any pointers for either:

  1. Variable volume on samplers in OSWeb (though maybe it's just not supported yet, which is fine of course!)
  2. How to get the URL for a file in the file pool, then I'll add an audio element using inline_javascript.

Thanks!

Comments

  • p.s. just checked and this does work with an external file URL for the sound using JS audio:

    const beep_url = "http://myserver.example.com/static/beep.ogg";
    const audio = new Audio(beep_url);
    audio.addEventListener(
        "canplaythrough",
        function () { audio.play(); }
    );
    

    It would still be nice to use the file pool, though not essential of course!

  • Hi,

    wrt to your first point, I don't see a reason why it shouldn't work/be implemented, so my guess would be this is a bug (at least I can confirm that the problem occurs). @sebastiaan what do you think?

    Eduard

    Buy Me A Coffee

  • Hi @alisdt and @eduard ,

    Sorry for the slow response—this fell off the radar for a bit. But indeed, there are two bugs here, and I just created an issue for them. Should be fixed in OSWeb 1.3.14, which should be included with OpenSesame 3.3.10!

    — Sebastiaan

  • Many thanks @sebastiaan , good to know!

Sign In or Register to comment.