OS (e.g. Win10): Win10
PsychoPy version (e.g. 1.84.x): 2023.2.3
Standard Standalone? (y/n) If not then what?: y
Hello, I am designing an experiment that presents sounds using PsychoPy 2023.2.3 and the PTB sound library.
I am performing the task of recognizing a heartbeat and playing a sound with a certain delay using the following code:
if oximeter.serial.inWaiting() >= 5:
paquet = list(oximeter.serial.read(5))
if oximeter.check(paquet): # Data consistency
oximeter.add_paquet(paquet[2]) # Add new data point
if oximeter.peaks[-1] == 1 :
oximeter.channels["Channel_0"][-1]=1
print("peak!")
now = ptb.GetSecs()
tone.play(when=now+1.5)
The upper part receives a specific trigger from the oximeter (I am using the systole package), and when an actual heartbeat is detected, it tries to play a tone (tone = sound.Sound(value=440, secs=0.2) defined in begin experiment) 1.5 seconds later.
However, if a new trigger occurs within 1.5 seconds, the delayed tone is not played, and the following error message occurs:
PsychPortAudio-WARNING: ‘Start’ method on audiodevice 1 called, although playback on device not yet completely stopped.
Will forcefully restart with possible audible artifacts or timing glitches.
Check your playback timing or use the ‘Stop’ function properly!
I want to play two or more sounds in parallel or overlapping, but if you have any advice, I would appreciate it.