Howdy, Stranger!

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

Supported by

Adapting coroutines for OSWeb


This is probably a very simple question for someone who knows how to code, so apologies in advance for that. I've created an auditory semantic decision experiment in OpenSesame but now I need to implement it on OSWeb. Essentially, an auditory stimulus is played. Participants can't respond before 400 ms from stimulus onset. If they respond via keypress they move onto the next trial. If they don't respond within 3000 ms a beep is played, and they get moved to the next trial. How can I implement this using inline javascript? Thank you!


  • Hi @sflu ,

    Depending on how much flexibility you need, the solution may actually be very simple and not require coroutines at all.

    • Let's say that you create a single audio file that contains both the audio stimulus and (after 3000 ms) the timeout warning. You can create this file with an audio editor such as Audacity.
    • Then you play this sound file with a sampler (audio_stimulus) and set the duration to 400, which is the period during you (based on the screenshot) don't want to collect a key press yet.
    • Then insert a keyboard_response with a timeout of 3600, which together with the 400 ms duration of the audio_stimulus adds up to 4000.
    • Then, after the keyboard_response , stop the audio_stimulus from playing (if it was still playing) with a script like the one below. This will avoid the timeout from playing if the participant responded in time.
    // This should be in the run phase of an `inline_javascript` item
    let audio = exp.items._items['audio_stimulus']._sampler.sample
    if (!audio.paused) {

    Do you see the logic? I attached an example experiment. (I made it in OpenSesame 4.0, but you should be able to run it also in 3.3.)

    — Sebastiaan

  • Hi Sebastian,

    Thank you for your response! If I set the duration of the stimulus to 400 ms, the file will not finish playing if it's longer than 400 ms, though, right? We have a list of about 1000 nouns that participants will go through, and there is some variation in length.

    Also, when I tried to run your example I got this error: ModuleNotFoundError: No module named 'openexp._canvas.osweb' Any idea what I need to do?

    Thanks again!

  • @sflu Right, it was set to use the OSWeb backend, which is new in 4.0. (Previously, OSWeb existed, but it integrated with the interface differently.) Here's the updated example. Does this run for you?

    You can also consider upgrading to OpenSesame 4.0. It's still in pre-release, but it's already quite stable at this point and has some nice new features.

  • Hi! Thanks, I'll check out the latest version. I've actually gone into a different direction now, and just put a sketchpad telling participants that they've timed out (at 3000 ms) instead of playing an audio file. I've also added self-timed breaks after every 5 trials. The issue I'm having now is that the feedback_item doesn't seem to present accuracy and response times correctly. For example, even if you make a mistake, you might get 100 % accuracy. Or if you time out a few times, the average response time is 3000 ms, even if you've responded more quickly. Do you have any idea why that might be? I've attached a screenshot of the trial_sequence as well as of what I have in the feedback form. Thanks for all your help!

  • Hi @sflu,

    I just saw your post (when replying to a message, it is best to user handles: @sebastiaan so that your correpondent receives a notification).

    Yes, the sound will carry on beyond the 400ms of the sampler.

    I believe that the error you mentioned may possibly be due to using an version of Open Sesame older than that Sebastiaan used to create the example (Which is version 4, now available for a test drive on the website:



    Buy Me A Coffee

  • Hi @Fab,

    Thanks for your message! I haven't upgraded to version 4 yet, but it seems the accuracy and response time problem only started to happen after I added a timeout warning and a self-timed break (as in the screenshot). Before that everything seemed to be fine. I didn't actually end up using Sebastiaan's example, instead of having an auditory timeout I'm presenting it on a sketchpad.

    But I'll download version 4 and run it to check if that might fix the error. Do you think I'll need to adapt anything in my experiment or should the parts that are working now continue to run ok?


  • FabFab
    edited April 2023

    Hi @sflu,

    From your screen shot it appears that you're using a Python inline_script, but Python is not supported in OSWeb. You need to use Javascript instead.

    Youo can modify your program without upgrading to version yet.


    Buy Me A Coffee

  • Hi @Fab,

    Thanks, I got rid of the Python script and changed the Run if statement instead. I also unchecked the Reset feedback variables box for the per trial feedback items in the sequence. It seems to be logging accuracy and average rt correctly now.


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