Howdy, Stranger!

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

Supported by

Plz, help me to design ABX auditory discrimination task!!!

Can anybody help me to design neat and clear this task?
I am new to this program and get in trouble with design the manual and operating it, I will be greatly appreciated if any body has the similar template for this experiment. I will do ABX discriminaion task for certain set of phonemic minimal pair, so the stimuli should be in certain set, for example, A-B-A, A-B-B with fixed word set(ex. dad-mad-mad).So far, I designed as follows: but I can't figure out how to manipulate those set with 3 sequential sound sampler with advanced-delay icon.

I'll be appreciated for your help or any similar template that I could take as a reference!!
Thank you~


  • Hello,

    Well I am no way an expert but the way I would design it would be as follow:

    • create a table with at least three columns: first_sound, second_sound, third_sound;

    • fill your table with the various sequence you want to use, remember each line is a trial so for A-B-C you could get, first_sound: A.wav, second_sound:B.wav, third_sound:C.wav;

    • create three sampler first_sound_present, second_sound_present, third_sound_present and put the name of the column corresponding to the sound that will be played in [ ], like this (it means it will play the value of the variable between [ ])

    And it should work.

    But now I do not really get your issue with the advanced delay. Just enter the time you want between sound no?



    Thanked by 1Youngshin
  • Thank you so much for your prompt reply.
    One more question, if I put this in random order, will each line be in the same trial but switch with the other trial, I mean the order of each trial can be randomly operated?

  • If you do this and enter random, it means that the whole sequences (A-B-B...) will be randomized.
    The way you could think about it is that each line in your table are and stay a single trial. So if you have:

    • line 1: A-A-A
    • line 2: B-B-B
    • line 3: C-C-C

    On randomized you could get for example:

    • trial 1: B-B-B
    • trial 2: C-C-C
    • trial 3: A-A-A


    • trial 1: A-B-C
    • trial 2: B-C-B
    • trial 3: C-A-A

    Lines are randomized, but elements within these lines stick together is what I mean.

    I dont know I hope I am clear.



    Thanked by 1Youngshin
  • Sylvain,
    Would you help me to operate mouse_response from the beginning of the experiment?
    I tried to put python decode message that copied from other forum, but didn't work. Also, after listening to the stimuli, I couldn't click the correct button A or B.
    (Yes, delay time is what the interstimuli interval time that I intended to operate)

  • Yeah I could hep but you need to tell us what you intend to do I do not really get it.
    I see from your screen capture that at the end of the sound sequence there is a reaction button slide and mouse response.
    What is the task of the subjet then? What do you collect?

  • The experiment I will perform is ABX discrimination task which the subject should chose one identical sound of the third stimuli. For example, if the subject hear A-B-B sequence words, then he/she should click the button B. So, here are several problems I have.
    1. I want to use mouse-response from the beginning of the experiment. (Such as click "ok" button-it didn't work)
    2. As you can see below I set the trial with certain matching stimuli played in random order. For example, f1-v1-f1 (trial1) and s1-z1-z1(trial 2) (as a set of trial, but can be placed in any order with other set of trial), x1-y1-y1. Not scrambled like this: f1-v2-f1, or x1-v1-x1, y2-s2-s2. (So far, before I put inline script and mouse_respond decode in script, it seems working, but not now)
    3. After the subject listen to the trial, they need to click A or B that is shown in reaction-buttons.
    Here are some pictures that I did so far.

    I'm deeply appreciated for your kind help and suggestion.

    Best regards,

  • Hey,

    In order to do that I would rather use a canvas with a little bit of scripting.
    Basically first define the correct answer in your table:

    Then just after the third_delay define an inline script. In the prepare phase you are defining every element in the canvas being used for the response:

    # create a canvas to collect the response
    canvas_response = Canvas()
    # Create the button A
    # var.width correspond to the width of your monitor
    # remember (0,0) is the center of your monitor for open sesame!
    # negative value for x indicate the part of the screen on the left
    # negative value for y indicate the part of the screen on the top
    # so we need two x positions, one on the left for button A
    # one of the right for button B
    # let say we place button A at 1/4 of your the monitor along the x axis
    x_button_A = 0 - (0.25 * var.width) 
    x_button_B = 0 + (0.25 * var.width) 
    # first we add the circle to the canvas. Notice we call them Button_A and Button_B
    canvas_response['Button_A'] = Circle(x = x_button_A, y = 0, r = 100, fill=True, color='white')
    canvas_response['Button_B'] = Circle(x = x_button_B, y = 0, r = 100, fill=True, color='white')
    # Now we add the label to the button
    canvas_response['Label_A'] = Text(text = 'A',center =True, x = x_button_A, y = 0, max_width=None, color='black')
    canvas_response['Label_B'] = Text(text = 'B', center = True, x = x_button_B, y = 0, max_width=None, color='black')

    And in the run phase you present the canvas and collect the response:

    reponse_not_pressed = True # variable just to be sure a response A or B will be pressed (and not another element of the screen)
    my_mouse = Mouse(visible=True) #initialize mouse response
    time_canvas_response_onset = # time of onset of the  canvas
    while reponse_not_pressed == True: # while no reponse A or B given
        button, (x, y), timestamp = my_mouse.get_click() # get the timestamp and (x,y) position of the mouse click
        for element in canvas_response.elements_at(x, y): # the position clicked correspond to an element of the canvas
            if not element.startswith('Button'): # if not buttons A or B pressed do nothing and continue
            if element == 'Button_A': # if Button A is pressed
                var.response_trial = 'A' # stock 'A' as the response for this trial
                var.reaction_time_trial = timestamp - time_canvas_response_onset # stock reaction_time_trial as the RT for this trial
                reponse_not_pressed = 'False'# change reponse_not_pressed to False to stop the loop
            if element == 'Button_B': # if Button B is pressed
                var.response_trial = 'B' # stock 'B' as the response for this trial
                var.reaction_time_trial = timestamp - time_canvas_response_onset # stock reaction_time_trial as the RT for this trial
                reponse_not_pressed = 'False' # change reponse_not_pressed to False to stop the loop #redraw the canvas if for instance another part of the canvas than a button response was pressed
    if var.response_trial == var.correct_response: # compare response given to the correct response expected
        var.accuracy_trial = 1 # good accuracy
        var.accuracy_trial = 0 # bad accuracy

    I hope the comment will make sense to you and you will be able to adjust them to your own experimental design.

    I also join a zip with everything (because there are also wav files you might need to see how it works)



    Thanked by 1Youngshin
  • Thank you Sooooooo~ much for your kind help, Sylvain.
    I revised my experimental design that is in the file. However, I cannot figure out how to define canvas. What I understand is my canvas is circle that has two position with text in it. So, I define my_canvas like this and I got this error message. I am a real novice learner of opensesame and python code so I am desperately seeking your help. I attach the error message and my inline script below.

    Looking forward your help~


  • Hey,

    Try to remember that your canvas is just like a canvas with a name.
    For instance:
    my_best_canvas = canvas()
    then my_best_canvas would be the name where you will put everything (circles, buttons...).

    Here in your script in your first line you are setting up a canvas called my_canvas, then you are drawing circles on a canvas that does not exist (Canvas.Circle).

    So what you have to do there:



    Thanked by 1Youngshin
  • Sylvain,
    I did deleted and try to run the scrip again as well as look thoroughly the manual you mentioned, however the same error message occurs. If you don't mind would you check my experimental design. I am really sorry to bother you.


  • Could you post a zip where you also include your sound otherywise I cannot run it.

  • Oh, I save the sound file in the file pool. However, if that doesn't work, I'll attach them separately. Thanks.

  • Hello,

    Ok there were several issues:

    • first in your script you had in your loop empty row. Be careful to get as many rows as trials, sometime it is easy not seeing that one row if filled with empty cells and then no sound in your case can be found when these lines (empty) serves as variables for a trial;
    • in your canvas definition for some reason you defined a canvas button that corresponded to nothing;
    • you did not account for no response with a continue in the run phase of the canvas inline (when participants click somewhere else than the button);
    • finally if you have your canvas it presents the display and collect the mouse response you do not need another sketchpad and mouse response item for that.

    Here is the script check it and see if everything is correctly logged (should be but double check)

    Thanked by 1Youngshin
  • edited May 12

    Thank you Sylvain for your kind help with clear explanation.
    Though still canvas definition problem remains in my computer. I just run the file you sent with sound file in the pool. (Is that because I didn't put the height of screen? if so, how can I get this height of screen? )May be I'll try keyboard correspondence instead of clicking button.
    Here is the message that I got:

  • Hello,

    In line 2 of the script I sent do you have:

    canvas_response = Canvas()

    If some reason you have:

    canvas_response = Canvas

    Just add the parenthesis ()



  • Thanks, Sylvain.
    I tried to operate with your original file which has parenthesis as you mentioned. However, it's still not working with error message that Canvas is not defined. Like this:

  • And same with the previous one in inline script :(

  • Wow it is so odd.

    Two questions:

    • if you just open the zip file I posted, run it without any modification the error still happens?
    • what is the version of open sesame you are running?
  • Yeah, I just add the voice files into the pool. (That's the only thing I did before I run)
    the version I'm running is the latest one(version 3.1)
    If I could use keyboard response instead of mouse and button, do I still need to type this inline script?
    I'm using window 7 is this the problem to run opensesame?

  • The latest version is the 3.2.4 could you just install this one and try to run the script I sent without any modification?
    Thanked by 1Youngshin
  • Wow! Finally, it works with the latest version! Thank you so much for your patience and big help!
    I was wondering with installing the new one, 'cause the installed icon didn't appear but show like this:

    (I don't know why it happens, I just guess there might be some crash or other minor problem~)

  • However, it finally works perfectly as I expected due to your great effort and care~
    I'll definitely donate to this program~.
    Have a nice week~

Sign In or Register to comment.