Howdy, Stranger!

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

Supported by

random presentation of random sounds

Hello,

I'm trying to have a random sound at random points in specific parts/moments of a temporal reproduction task.

The experiment is structured as follows:

  • 4 numbers appear on the screen for a few secs
  • temporal reproduction task starts (a 'beep' sound of variable duration is delivered for encoding)
  • participants press a key to start the second 'beep' sound (reproducing)
  • participants press a key when they think the sound reached the same duration as the previous one
  • 1 number appears asking if it was present or not among the firsts at the beginning (WM task)

I have 6 different sounds, and I want to present them randomly during the task but NOT when the 'beep' sound is delivered (in both encoding and reproducing phases). It means that it should be delivered during the 4 numbers presentation or right after that/before the encoding part or after the reproducing part/during the WM task (1 number presentation). Also, the random sound should be delivered in ~6% of the trials (60).

I managed to set up the rest of the experiment, but I'm having trouble with this. Can you suggest a way to implement it?

Thank you!

Comments

  • edited February 2023

    Hi @gl2508 ,

    I would define a variable in the block loop (distractor ) that decides which, if any, distractor sampler should be played, for example by using 0 for no distractor, 1 for just before the memory display, 2 for right after the memory display, etc. Next you insert a sampler with the distractor sound at each of these points in the trial sequence, and use run-if statements to determine which distractor sampler, if any, should be played back, for example [distractor] = 1 for the distractor sampler just before the memory display.

    If you don't want to define the distractor variable manually, but simply want a distractor to be played at a random moment on 6% of trials, you can also use a Python inline_script at the start of the trial to define the distractor variable (this should be in the prepare phase):

    import random
    if sometimes(.06):
       # assuming there are three possible distractor samplers
       var.distractor = random.choice([1, 2, 3])
    else:
       var.distractor = 0
    

    Do you see the logic? Hope this helps!

    — Sebastiaan

Sign In or Register to comment.