Howdy, Stranger!

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

Supported by

randome metronome in OS timing task

Hi there!

In my experiment, participants have to press the space key of the laptop repeatedly in 1-s intervals after listening to 10 beats of that 1-s interval. I now want to implement a distraction by having a random metronome (M = 800, SD = 200) playing in the background of this task.

Since I do not really have a good starting point here, my question is: Is it possible to implement such a metronome distraction within the experiment I created (so playing after the 10 sounds of the 1-s interval for each the practice and experimental trial) or do I have to create a new OS-experiment with only the metronome and play that from a different device? Further, do you have any ideas on how to create such a randome metronome?

Thanks in advance!:)


  • Hi,

    I attach an experiment in which I give an example on how to implement the random metronome together with polling for keyboard responses in the same inline_script. I didn't quite understand your script with the remapping of the buttons and all that stuff. For the reproduction the inline_script reproduce is everything you should need.

    Let me know if you have further questions.


    Buy Me A Coffee

  • edited October 2022

    Sorry to 'hijack' this thread but I have a similar question. I also want to implement a metronome but one that runs at a regular interval for 1 or 2 minutes while the participant carries out an off-screen task to the beat of the metronome (e.g. tapping their foot on a pedal). However, I'm not sure about the frequency option of the synth item. The participant should tap their foot at a rate of 80 taps per minute but apparently this is 1.3333 when converted to Hz (for the frequency), which doesn't seem right - this is quite different from the default of 440 and obviously you can't hear anything!

    Also, I would like to add a sketchpad item with say, a button which changes colour and/or gets bigger in time with the metronome beat, to better aid their timing. Is there some way to do this and would I need to put this all in a loop?

    Thank you in advance!

  • Hi Pikachu (never thought I would ever say that...),

    However, I'm not sure about the frequency option of the synth item

    The frequency of the Synth item only specifies the pitch of the sound that is being played and has nothing to do with the rhythm. I recommend you use the Synth item with its default settings (making sure that the sound is short and doesn't linger while waiting for a response), and add an empty sketchpad, or an advanced delay item to the sequence after the sound. Then you set the duration of that sketchpad to something like 750 (750 ms should correspond to 80 bpm). What then happens is that you have a loop-sequence with two items: the Synth item and a delay item. The Synth takes care of the sound, and the delay item takes care of the rhythm. Does that make sense?

    Also, I would like to add a sketchpad item with say, a button which changes colour and/or gets bigger in time with the metronome beat, to better aid their timing. Is there some way to do this and would I need to put this all in a loop?

    Even better. This sketchpad's duration can then be used for specifying the rhythm. To dynamically change the size of it (color is harder to make appear smooth), you need an inline_script that increases a size variable by some small constant on every iteration. And specify in the sketchpad the size of the circle with a variabe (such that it will be updated dynamically).

    Let me know if you can't make it work. Then I will provide an example.


    Buy Me A Coffee

  • edited November 2022

    Hi Eduard (hope that was a nice 'shock' haha πŸ˜€......sorry πŸ˜…),

    Thank you for your reply and for the info.

    I had a go and ended up with a flashing circle (more by accident!). I think it actually works better than a circle which changes colour or grows in size. How do I specify that I would like the metronome to run for a total of 2 minutes? I tried specifying timeout in the Prepare phase of the inline_script but it doesn't have any effect - is it in the number of cycles in the loop item?

  • Hi,

    You can start a timer in Python before the circle loop, and update it inside the loop. Set the break if statement of the loop to "whenever the timer runs longer than 120 seconds" and you should be set.

    See this example.

    Buy Me A Coffee

  • edited November 2022

    Hi eduard,

    Thank you! I tried integrating this into my OS file but it only runs through 1 'trial' (matching the duration of the sketchpad, which I've set to 750 - could that be the problem?). Also, the sound seems to come on before the red dot - I guess I might need to set the timing for the dot in the inline_script to match that of the sound?

  • but it only runs through 1 'trial'

    It runs through only one trial, because your experiment is only contains a single iteration of one loop. If you set the number of repeats to a high number (higher than the expected 120s duration, it should work like you want it.

    the sound seems to come on before the red dot

    I guess this is because the duration of the sound (set it to 0 instead of sound). Aside of that sound perception is more instant than visual perception. So if both stimuli occur at the same time, the sound will quicker be processed (ignoring multisensory integration)


    Buy Me A Coffee

  • Thank you for all your help, Eduard! It's much appreciated - I've managed to sort it now. πŸ™‚

  • Sorry to revive this thread! I've integrated the metronome into the main script but have noticed 2 things:

    • there seems to be a delay between the beat and the onset of the red dot (I know you mentioned sound perception is more instant than vision but there does seem to be an actual, albeit short, lag), despite having set the duration of the sketchpad to 0 (rather than sound)
    • occasionally, a beat will be louder than the others (not sure why this is as the volume is set to 1 in the synth item and should be constant in this part)

    I would attach the OS script but it comes up with a 'request failed with status code 413' error message, maybe because the file is too large (1,271 KB)?

  • Hi @Pikachu ,

    If the file is too large could you perhaps use something like WeTransfer?



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

  • Hi @Lotje,

    Good idea - thanks for the suggestion! Here it is:

    Another thing is, after testing the experiment twice, I noticed the metronome only played one beat the first time. Then, when I tested it later on (without changing anything), it ran for the full 2 minutes. Not sure why there's this inconsistency.



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