Play stimuli from subfolders
in OpenSesame
Hi everyone,
I was wondering whether it is possible to have multiple folders in the pool. In my current experiment I have quite a number of stimuli, so it is impractical to have only one folder.
Alternatively, is it possible to load stimulis from subfolders of the experiment folder using javascript and OSWeb? Something like:
var stimuli = new Audio('audio/my_sound.wav');
stimuli.play()
I tried to run this code but it does not play any sound. Any idea?
Thanks,
Silk--
Comments
Hi @Silk ,
Not really, I'm afraid. Just to clarify: When an experiment runs in a browser with OSWeb, the file pool doesn't actually correspond to a folder (unlike when an experiment runs on the desktop). Instead, the file pool is an array-like container of objects.
To get a feel of how this works, you can add a
debuggerstatement to aninline_javascriptitem and then run the experiment while the browser console is visible. The experiment will then pause an allow you to inspect the JavaScript workspace, including thepoolobject:As you can see, the file
notify1.oggis represented as an object with adataproperty that corresponds to anAudioobject. So to play the file in aninline_javascriptyou would do:See also:
— Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!