Howdy, Stranger!

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

Supported by

auto-repeat the audio stimulus within the same trial


In a loop we need to administer an audio stimulus (a musical phrase) together with different images. The subject is asked to associate one image to the music.

According to the protocol the musical phrase should be presented continuosly, id est in loop, till the subject's response.

Is it possible ?

Thank You for your attention and MANY THANKS to the developers of OpenSesame,



  • Hi Dan,

    That is possible, but requires using python inline coding (I don't think the Sampler GUI item, has a repeat setting).

    What you would want to do, is creating a while loop that tracks the progression of time, and starts the sampler every time the duration of the sample has passed. Additionally, this loop check whether a response has been given and breaks the loop once this happens. More info here:

    And here a skeleton example:

    # load sample
    src = pool['bark.ogg']
    my_sampler = Sampler(src, volume=.5)
    # create a keyboard
    my_kb = Keyboard(timeout = 0)
    start_time = clock.time()
    # how long is the sample?
    sample_duration = 1000
    # loop until a key is pressed
    # <add some code to present your images>
    while True: 
          # check if sample duration has been passed and restart
          if start_time-clock.time()> sample_duration:
             start_time = clock.time()
         # check for a keyboard response
         k,t = my_kb.get_key()
         if k != None:

    I hope this helps,


    Buy Me A Coffee

  • Thank You Eduard for your attention and your patience.

    OpenSesame stops while compiling the script:

    File "C:\Program Files (x86)\OpenSesame\Lib\site-packages\libopensesame\", line 81, in prepare
        self.var.get(u'_run', _eval=False))
     File "C:\Program Files (x86)\OpenSesame\Lib\site-packages\libopensesame\", line 110, in _compile
        return compile(script, u'<string>', u'exec')
     Inline script, line 18
        k,t = my_kb.get_key()
    IndentationError: unindent does not match any outer indentation level

  • Hi Dan,

    I typed this example in the window here, so the formatting cannot be trusted. The error is quite clear actually. It says IndentationError so you should check whether the indentation level checks out. Are you familiar with Python syntax? If not have a look here: (particularly the tutorials). In short, in Python the indentation level is critical to parse the code into blocks. Indentation level is basically defined by how many white space (space bar) characters appear in the beginning of the line. For each code block (for-loop, if-else statement, etc) the number of white space has to match.

    What the problem in your specific case is, I cannot say without seeing how you included the code into your experiment. If you share your experiment, I can help better.


    Buy Me A Coffee

  • Thank you Eduard,

    again, I learned a new thing: indentation is not just a matter of aesthetics.

    Yes sure, may I share the whole file here ?


  • Yes, you can!

    Buy Me A Coffee

  • edited February 22

    Voilà, I attach two files

    thank you Eduard :-)

  • Hi,

    I added the new version that includes the basic working example. The fine-tuning is left, but I am sure you can handle it. When you use the inline_script, it make sense to run the response collection and stimulus presentation also with it. Therefore you probably want to remove the keyboard_response item and (some of) the sketchpads. But see for yourself what makes sense.

    Good luck,


    Buy Me A Coffee

  • Thank you Eduard,

    I am experimenting by consequence of the file you sent me and of



Sign In or Register to comment.

agen judi bola , sportbook, casino, togel, number game, singapore, tangkas, basket, slot, poker, dominoqq, agen bola. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 50.000 ,- bonus cashback hingga 10% , diskon togel hingga 66% bisa bermain di android dan IOS kapanpun dan dimana pun. poker , bandarq , aduq, domino qq , dominobet. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 10.000 ,- bonus turnover 0.5% dan bonus referral 20%. Bonus - bonus yang dihadirkan bisa terbilang cukup tinggi dan memuaskan, anda hanya perlu memasang pada situs yang memberikan bursa pasaran terbaik yaitu Bola168. Situs penyedia segala jenis permainan poker online kini semakin banyak ditemukan di Internet, salah satunya TahunQQ merupakan situs Agen Judi Domino66 Dan BandarQ Terpercaya yang mampu memberikan banyak provit bagi bettornya. Permainan Yang Di Sediakan Dewi365 Juga sangat banyak Dan menarik dan Peluang untuk memenangkan Taruhan Judi online ini juga sangat mudah . Mainkan Segera Taruhan Sportbook anda bersama Agen Judi Bola Bersama Dewi365 Kemenangan Anda Berapa pun akan Terbayarkan. Tersedia 9 macam permainan seru yang bisa kamu mainkan hanya di dalam 1 ID saja. Permainan seru yang tersedia seperti Poker, Domino QQ Dan juga BandarQ Online. Semuanya tersedia lengkap hanya di ABGQQ. Situs ABGQQ sangat mudah dimenangkan, kamu juga akan mendapatkan mega bonus dan setiap pemain berhak mendapatkan cashback mingguan. ABGQQ juga telah diakui sebagai Bandar Domino Online yang menjamin sistem FAIR PLAY disetiap permainan yang bisa dimainkan dengan deposit minimal hanya Rp.25.000. DEWI365 adalah Bandar Judi Bola Terpercaya & resmi dan terpercaya di indonesia. Situs judi bola ini menyediakan fasilitas bagi anda untuk dapat bermain memainkan permainan judi bola. Didalam situs ini memiliki berbagai permainan taruhan bola terlengkap seperti Sbobet, yang membuat DEWI365 menjadi situs judi bola terbaik dan terpercaya di Indonesia. Tentunya sebagai situs yang bertugas sebagai Bandar Poker Online pastinya akan berusaha untuk menjaga semua informasi dan keamanan yang terdapat di POKERQQ13. Kotakqq adalah situs Judi Poker Online Terpercayayang menyediakan 9 jenis permainan sakong online, dominoqq, domino99, bandarq, bandar ceme, aduq, poker online, bandar poker, balak66, perang baccarat, dan capsa susun. Dengan minimal deposit withdraw 15.000 Anda sudah bisa memainkan semua permaina pkv games di situs kami. Jackpot besar,Win rate tinggi, Fair play, PKV Games