Howdy, Stranger!

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

Supported by

[solved] variables in sampler

edited June 2015 in OpenSesame

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

  • edited 3:38PM

    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)

    B) Work around the bug, by inserting the following script in the prepare phase of an inline_script item at the start of the trial sequence:

    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

  • edited 3:38PM

    Thanks you Sebastiaan! I downloaded the new version and it worked like a charm.

  • joejoe
    edited 3:38PM

    I'm having this same problem, but I have version 0.26. Can you tell me why this is happening?

  • edited 3:38PM

    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:

    • Open the "General properties" tab, click "Script editor" and copy the whole script,
    • go to http://pastbin.com or http://gist.github.com, upload your script there (simply paste and submit)
    • and provide us with the resulting link in your forum post.

    Best,

    Lotje

    Did you like my answer? Feel free to Buy Me A Coffee :)

  • joejoe
    edited October 2013

    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:

    Error: Runtime error
    Description: Failed to load sample in sampler '___sampler': openexp._sampler.legacy.__init__() the file '.wav' does not exist
    

    Thank you

  • edited 3:38PM

    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'.

    image

    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.

    Sometimes the error will happen from the beginning, other times it wont happen until after a few .wav files have played.

    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 Buy Me A Coffee :)

  • edited 3:38PM

    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.

  • edited 3:38PM

    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

    Buy Me A Coffee

Sign In or Register to comment.