Sending Triggers via UDP

I use a tool called Unicorn Recorder, which can receive triggers via UDP (GitHub - unicorn-bi/Unicorn-Recorder-Hybrid-Black: Unicorn Recorder Hybrid Black). I am curious, if PsychoPy can send triggers via UDP? I found only the option via LSL, but the Unicorn Recorder has no LSL receiver.
Thank you.

Perhaps an oversimplification: If you can do it in Python, you can probably do it with PsychoPy.

It looks like the software has code for doing python communication on the GitHub page:

import socket

# Initialize socket
socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
endPoint = ("127.0.0.1", 1000)

# Send trigger
sendBytes = b"1"
socket.sendto(sendBytes, endPoint)

You could add a trigger sending to your event loop by adding those bits for sending the trigger into your “each frame” in builder.

1 Like