Sampler unable to select certain values from the loop
Hello,
recently I've been trying to create an experiment in OpenSesame. Its goal was to measure reaction time based on visual and auditory stimuli. I made a loop with two columns: one named "stimuli", where, in total, I have put 40 values such as "cat, dog, forest, water, cat1.wav, dog1.wav, forest1.wav, water1.wav", and the latter named "type", where I have put values "text" next to regular values, and "sound" next to values that end with "1.wav". The loop is composed in such a way because it is supposed to randomly show words and play sounds (e.g. 3 written words in a row, 1 spoken word, or 1 spoken word, 1 written word, 2 spoken words in a row. etc.) Were I to create a loop where regular values are in one column, and "1.wav" values are in another column, the program would play written word / spoken word / written word / spoken word alternately, such pattern would make the experiment too predictable (even in loop's order set to random). I have both sketchpad (for written words) and sampler (for spoken words) inserted into sequence (which is inserted into the loop itself). The thing is, when I try to run the experiment, it crashes the moment the sampler tries to play a value from the loop other than the ones that have 1.wav in them.
The problem is, the sampler finds it difficult to filter out non-1.wav value names. It is worth mentioning that both sktechpad and sampler have a{stimuli}
variable written into them (textline element for sketchpad and sound file for sampler), whereas this doesn't happen to be a problem in the sketchpad, since it ignores 1.wav values by simply putting [type] == "text"
into sketchpad's Show if statement, unfortunately Show if doesn't exist in sampler's settings. Furthermore, sequence's Run if statements either don't work correctly, or I possess expired information regarding Run if command writing. I should also mention that every time the sampler chooses a value with 1.wav in its name, the sound is played correctly, so it seems that my files in the file pool work just fine.
Is there any way (preferably without the inline script) to make it work?
Best regards.
Comments
Hi @simon3,
Could you provide the error you are getting from the console when it crashes? Also, if you could provide your experiment file, that would be really helpful to better understand the nature of the problem here.
Claire
Check out SigmundAI.eu for our OpenSesame AI assistant! 🤖
Hi,
thanks for responding. Sometimes the problem won't trigger instantly because the loop might choose values with 1.wav. That said, an error will eventually occur after a few tries.
Hi @simon3,
It is indeed as if the sampler item is still looking for an audio file from the "stimuli" variable, even if it doesn't show up in the experiment i.e., if you explicitly add a "run if" statement in the sequence item.
I've run into this problem before, and a simple workaround I found to deal with the sampler's need to have a file to play even when it's not supposed to play any sound was to provide a dummy audio file ("none.wav" of 0-s duration) associated with the non-audio stimuli.
You would then have 3 columns : stimuli, type and filename, and use the "run if" statements for the items you want to show or not show depending on their type.
Let me know if this solution works for you!
Claire
Check out SigmundAI.eu for our OpenSesame AI assistant! 🤖
Works just as intented.
Thank you very much for your help!
Cheers!