Howdy, Stranger!

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

Supported by

random sounds during visual illusion

ANRANR
edited April 2016 in OpenSesame

Hey guys,
I am trying to randomly pick sounds from a file pool and play them at randomly picked time intervals while showing a visual illusion (which is implemented in a while-loop which flickers between two versions of the stimulus until a certain time passed).
I thought I could just use the sampler item, but ran into two problems:

1) all sounds are being played at the same time at the beginning of the instructions (implemented as sketchpad).

2) both, the self.sleep and the core.wait, functions that I tried to use to make the sounds play at random intervals also pause the visual stimulus, which makes it pretty much useless.

Is there maybe a way to create two windows (one for the visual and one for the sound) that are called at the same time?

I am very inexperienced in using openSesame, so hopefully one of you has an idea how to fix this!

Comments

  • edited 10:49AM

    Hi,

    Could it be that the commands that play your sounds are placed in the prepare phase of an inline_script? Prepare phases are run before everything else, so that could explain why you hear your sounds right away..

    And yes, the self.sleep() command really let's the whole experiment sleep, so you can't use it for only a single object. The solution would be to keep track of time in a separate variable, for instance as such:

     start_time = self.time()
    

    and then in the while loop:

     current_time = self.time() - start_time
     if current_time = your_randomly_chosen_time_interval:
            your_sound.play()
    

    Does this help?

    Cheers,

    Josh

  • ANRANR
    edited 10:49AM

    Yes! I had the sampler items in the sequence, which made them all play at the same time after the script was done. Deleting those got rid of that.
    And the timing also works now with a new variable, thanks a bunch!

  • edited 10:49AM

    Hi Josh, I'm running a somewhat similar experiment to ANR and seem to be having trouble with the code. At the moment it's randomising the playback time that's giving me trouble. I used your method above but when I print the current_time variable I'm getting 0. I'm assuming the problem is that the start_time variable is constantly updating and so the values of current_time and start_time are always equal. Any help you could offer would be greatly appreciated. My code is below.

    time = range(0, 1000)
    play_time = random.choice(time)
    print play_time

    start_time = self.time()
    current_time = self.time() - start_time
    print current_time
    if current_time == play_time:
    deviant.play()

  • edited 10:49AM

    I have solved the issue myself. Very new to programming and didn't realise that I would need to set up a while loop to have the current_time constantly update.

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