[solved] variables in sampler
Hi there,
I'm creating a task where subjects have to categorize sounds. Two variables are being manipulated for every sound: [stop] and [puff]. I have named the sound files in my file pool according to the values of these variables in the format [stop][puff].wav (eg. ta_65.wav), and I've edited the script for the sampler item to read: set sample "[stop][puff].wav" . I'm trying to get the sampler to pick a file from the file pool in each trial based on these variables, but opensesame gives me the following error message: Failed to load sample in sampler 'stimulus': sampler.init() the file '[stop]_[puff].wav' does not exist .
How do I fix this?
Thanks!
Naomi
Comments
Hi Naomi,
Thank you for your interest in OpenSesame!
This is a bug in previous versions of OpenSesame. What you can do is
A) update to 0.25 (released today)
self.experiment.set("my_sound_file", self.get("stop")+"_"+self.get("puff")+".wav")This creates a new variable "my_sound_file", which can be used in the sampler as [my_sound_file]. (If you don't mix variables and regular text it works, despite the bug).
Hope this helps!
Regards,
Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!
Thanks you Sebastiaan! I downloaded the new version and it worked like a charm.
I'm having this same problem, but I have version 0.26. Can you tell me why this is happening?
Hi Joe,
Could you provide us with some more information? How are you using the sampler item? And where does it go wrong? What kind of error message do you get? Perhaps it would be easiest if you could upload your experimental script here by doing the following:
Best,
Lotje
Did you like my answer? Feel free to

Hi Lotje,
I've uploaded my script. Here is the link: http://pastebin.com/QmfTQQKD
What I'm trying to do is have 11 .wav files play at a random order. It is a mix of English "we" and French "oui" words and I have it set up so the participant will press 1 for English and 2 for French. Sometimes the error will happen from the beginning, other times it wont happen until after a few .wav files have played. I'm very new to open sesame so I'm not too saavy at this point.
The error reads:
Thank you
Hi Joe,
You set the number of cycles in your loop item to 12, although only 11 cycles contain a value for the variable 'sibilant_type'.
As a consequence, in cycle 12 the sampler item is looking for a file called " .wav" (instead of .e.g , "Female Speaker 1-stimulus001.wav"), which does not exist. This causes the error message.
Thus, simply setting the number of cycles to 11 instead of 12 should solve the problem.
This part can be explained by the fact that the order of the loop item is set to random.
Does that make sense?
Cheers,
Lotje
Did you like my answer? Feel free to

Hello Sebastian, thank you for opensesame. Could you help me?
I need to design an perception task and test how people discriminate two different sounds, and I try to get the sampler to pick two sound files in the pool at a time. I added two variables as [word1] and [word2]. I also try to get the subject hear the second sound file after 500ms. But the script like [word1] 500ms [word2] seemed wrong.
Hi Sophia,
I suppose it might be better if you post your problem in a separate discussion, otherwise it's easily overlooked.
Regarding your problem, in order to be able to help you, we need more information what you did exactly and what it is that goes wrong. So, you could post your code, and/or the error message. At any rate, more details are necessary, before I can help.
Thanks,
Eduard