psychopy.org | Reference | Downloads | Github

Auditory oddball paradigm help needed

Hello everyone,

I am trying to figure out how to create an auditory oddball paradigm. Basically in the experiment participants watch a video clip (7 mins) and during the clip I want to present an auditory oddball paradigm of beep sounds. These beep sounds should appear randomly every 6-10 seconds. At first, a pairs of six pairs of beeps should go through (with 700ms ISI between the the pair) and afterwards every 1-5 pairs (randomised 1-5) a single beep should be presented instead of a pair.

Any help on this would be immense I’m having a difficult time designing it. Any example code would be super helpful :frowning:

I haven’t written an oddball task myself yet, but there is one available you could look at: Julia Sadka / Oddball Task · GitLab

I’ve looked at the code but it is way too different from what I’ve been trying to do. I’ll post my non-functioning code early next week - it should be easier for someone to spot the mistakes I’ve done

Before moving into oddball paradigm I am trying to have a pair of two vibrations occur randomly every 6-10 seconds. The second vibration (tactors2) should come out 1 second after the first one. The vibrations occur through a device that acts sort of like a woofer. Hence audio is played each time I want to trigger vibrations. For some reason only the first vibration (tactors1) occurs. Can anyone spot what I am doing wrong? I’ve commented out the code that sends triggers to EEG system and turns on/off the tactor device :confused:

#begin experiment

> import serial
> from psychopy import sound
> import serial
> import psychtoolbox as ptb
> 
> tactors1 = sound.Sound('test_100_200Hz.wav', name='$tactors1', stereo = True, secs = 0.1)
> tactors1.setVolume(1)
> tactors1.playing = False
> tactors1.waiting = False
> 
> tactors2 = sound.Sound('test_100_200Hz.wav', name='$tactors2', stereo = True, secs = 0.1)
> tactors2.setVolume(1)
> tactors2.playing = False
> tactors2.waiting = False
> 
> 
> #port_tactors = serial.Serial('COM8',57600)
> #port_tactors.write([0x1b,0x54, 0x31, 0x4c])
> #port_tactors.write([0x1b,0x54, 0x32, 0x52])
> 
> #port_trigger_eeg = serial.Serial('COM5')
> #port_trigger_eeg.write([0x00])
>  #begin routine
> tactors1Onsets=[]
> tactors1ISIs=[]
> pulse_started_tactors1 = False
> pulse_ended_tactors1 = False
> 
> pulse_started_trigger = False
> pulse_ended_trigger = False
> #each frame
> # we want to present the tone every
> # 6 - 10 seconds for the duration of the trial
> # if the sound is not currently playing
> if not tactors1.playing and not tactors1.waiting:
>     # pick how long we will wait for
>     tactors1ISI = randint(6, 10)
>     print('tactorISI', tactors1ISI)
>     tactors1ISIs.append(tactors1ISI)
>     tactors1Onset = t +tactors1ISI
>     #we are waiting for the sound to play
>     tactors1.waiting = True
>     pulse_started_tactors1 = False
>     #port_tactors.write([0x1b, 0x54, 0x31, 0x4c, 0x44])
>     #port_tactors.write([0x1b, 0x54, 0x32, 0x52, 0x44])
>     #port_trigger_eeg.write([0x00])
> elif not tactors1.playing and tactors1.waiting:
>     if t >= tactors1Onset:
>         print('playing')
>         tactors1.play()
>         tactors1Onsets.append(t)
>         tactors1.waiting = False
>         tactors2.waiting = True
>         #port_tactors.write([0x1b, 0x54, 0x31,0x45])
>         #port_tactors.write([0x1b, 0x54, 0x32,0x45])
>         
> elif tactors1.playing:
>     if t >= tactors1Onset + tactors1.secs:
>         tactors1.stop()
>         tactors1.playing = False
>         now = ptb.GetSecs() #start counting for second vibration
>         tactors2.waiting = False
>         tactors2.playing = True
>         tactors2.play(when=now+1)  # play in EXACTLY 1s after first vibration
>         #port_tactors.write([0x1b, 0x54, 0x31,0x44])
>         #port_tactors.write([0x1b, 0x54, 0x32,0x44])
> 
> if tactors1.playing == True and not pulse_started_tactors1:
>     #port_trigger_eeg.write([0x01])
>     pulse_start_time_tactors1 = globalClock.getTime()
>     pulse_started_tactors1 = True
> 
> if pulse_started_tactors1 and not pulse_ended_tactors1:
>     if globalClock.getTime() - pulse_start_time_tactors1 >= 5:
>         #port_trigger_eeg.write([0x00])
>         pulse_ended_tactors1 = True
>         #port_tactors.write([0x1b, 0x54, 0x31,0x44])
>         #port_tactors.write([0x1b, 0x54, 0x32,0x44])