Howdy, Stranger!

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

Supported by

Help! Complete newbie, completely lost on how to set mouse click regions and repeat audio files

Hi,
I'm very new to OpenSesame and I'd like to find out how to do two things, for starters:

  1. How to repeat an audio file for a practice round after a certain number of milliseconds - I want to play the file after 500ms, then repeat the audio file after a 1500ms break

  2. How to set a sketchpad with clickable regions - I want my participants to be able to see a sentence written on the screen and then be able to click on individual words in the sentence, which will present them with either positive or negative feedback

Can anyone help, or would anyone else be willing to share a script that they used for an experiment with audio stimuli? I'm feeling completely lost at the moment.

Cheers,
Emma

Comments

  • Hi Emma,

    regarding your second point: If you want to define clickable regions on a sketchpad, you could use the mousetrap_response plugin for OpenSesame: https://github.com/pascalkieslich/mousetrap-os

    However, one caveat regarding your specific design: using the plugin you can easily define a rectangular region on a screen that represents a button - this is done in the pixel metric used by OpenSesame sketchpads. However, if this regions differs for each stimuli because of the word length and word position in the sentence, it will likely be challenging to come up with the corresponding screen coordinates beforehand.

    Best,

    Pascal

  • Hi Emma, welcome to the forum!

    To start off with your second question, when you collect a mouse response (with the mouse response item), it logs the button but also the X and Y-coordinates. You can use these coordinates to provide participants positive or negative feedback; but as you might have anticipated, this would require you to specify a set of coordinates belonging to the region (in your case a word) for which the feedback should be positive. This inevitably requires some coding (using the inline_script item).

    For starters, look up how you can create a canvas (as alternative to the sketchpad item) here: http://osdoc.cogsci.nl/3.1/manual/python/canvas/
    You will see there is also a canvas.text_size function, which returns the amount of pixels of your sentence, or an individual word (e.g. your_canvas.text_size('hello')[0] returns the amount of pixels in the horizontal dimension occupied by 'hello' on your canvas; you do need to make the canvas named your_canvas first though). If I wanted to have the coordinates of a specific word in my sentence, I might do the following:

      sentence = 'This is just a sentence' # And let's say 'is' will be our correct word
      my_canvas = self.offline_canvas()
      my_canvas.text(sentence) #this puts the sentence on the canvas
    
      sentence_startpoint_X = my_canvas.xcenter() - 0.5*my_canvas.text_size(sentence)[0] 
          # in order to find the startpoint coordinate, we have to move half the sentence length to the left from the screen center
    
      left_coordinate = sentence_startpoint_X + my_canvas.text_size(sentence.split(' ')[0])[0]
           # 'is' is located to the right of the sentence's first word, so from the startpoint we have to move a distance equal to the sentence's first word to the right, to find the leftmost coordinate of our region
    
      right_coordinate = left_coordinate + my_canvas.text_size(sentence.split(' ')[1])[0]
    

    Now I have the two coordinates, in between of which my mouse response x-coordinate should be for the response to be correct. Determining whether the response is correct will also have to be done in an inline script.

    If you've become acquainted with this scripting, then your audio file shouldn't be a problem anymore either. You can find the sampler functions here: http://osdoc.cogsci.nl/2.8/python/sampler/ And you can use a simple self.sleep(1500) to have a 1500ms break.

    Cheers

    Josh

  • That's brilliant, thanks Josh! The only thing I don't understand is where I actually get the 'canvas' option to insert into the flow of my experiment, as there's no shortcut for it like the sketchpad?

  • edited December 2016

    Hi Emma, you'll have to use the inline_script item, and include the lines of code as indicated by the manual (and in the example I gave above).

    You thus build your screen using that code, and then you actually show the canvas by inserting my_canvas.show() in the run-phase of the inline_script. (if your canvas is named my_canvas; that is up to you).

    You can also do this tutorial http://osdoc.cogsci.nl/3.1/tutorials/intermediate/ as it shows how to use inline_scripts and canvasses.

    Cheers

    Josh

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 http://45.77.173.118/ 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