Howdy, Stranger!

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

Supported by

Metronome - repeat a sound throughout the experiment


I have the following task: the subjects have to identify the number of points in a set. Each set stays on screen until they press a key. 

I need a sound to play in the background every one second (a click sound for example) until the task is completed (40 sets of points in total).

So far I've managed to make the sound play once with each set by placing a sampler inside the inline_script where I created the stimuli, or for the sound to be repeated throughout the task with a clock.loop_for () in an inline_script outside the loop but i cannot control the ms between each sound. In addition, i used clock.loop_for(50000) to cover the whole task and the experiment crashes.  

I'm guessing this is something simple to do, but I've tried every tutorial I could find an I'm not getting anywhere. Sorry for my English. If someone can give me a hand I would be very grateful. 


  • Hi,

    I recommend to predefine the sets of dots (your 40 trials), that is, preparing lists with stimulus position, etc. Maybe even prepare the 40 canvasses in advance. Once you done that, you can (in an inline_script) make a while loop that runs forever. In this while loop you keep track of the time and present a click every time a second has passed. Also in the same while loop, you add a phase in which you present a stimulus (if there was a keypress), and one in which you sample for keypresses. Does that make sense? I'll put a conceptual example below:

    # prepare sampler
    ## load the sound files and prepare the sampler
    # prepare canvasses
    ## draw the canvasses with the dots and save the canvasses in a list
    #make a keyboard item
    kb = Keyboard()
    #start timer
    t0= canvas_list.pop(0).show()
    while True:
        if clock.time()-t0>1000:
             t0= clock.time()
        k,t = kb.get_key()
        if k != None:
            if len(canvas_list) == 0:

    Does that make sense?


  • Hi Eduard,

    Thanks a lot for the quick response. I get the general idea but I do not have list of canvasses, just a list of groups of dots

    When i try to use list.pop(0).show() with my list (circulos.pop(0).show()) instead of a canvasses list, it tells me that a 'str' object has no attribute 'show'. Do you know what I am doing wrong?

    Tranks again for your help,


  • Hi Jesi,

    You have now a loop for the number of dots in a single trial. But what I meant is that you need a loop for the trials. So, if you wrap another loop around your for loop (loop as often as you have trials), then you will have a list of dot lists. This outer list is then what you can use to bring the trials one by one on the screen. Does that make more sense? Also, the function xy_random returns a list of dots. That means that when drawing them, you still have to loop over them, so something like:

    for x,y in circulos:

    or if you have the nested list:

    for x,y in circulos[current_trial_index]:


    PS: If you share code, please post it as a text not as a screenshot. This will make it easier to edit it.

  • Hi Eduard,

    Thank you very much!


    PS: I did not know that, sorry!

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