External Application Data Recorder - Network Integration Guide
This guide explains how to control the SightLab Data Recorder from external applications like Unreal Engine, Unity, or other networked programs.
Overview
The recorder supports UDP-based networking to receive commands from external applications. This allows you to:
- Start/stop recording trials remotely
- Send synchronization markers during experiments
- Receive acknowledgment messages from the recorder
Configuration
In Data_Recorder_Config.py
# Enable network controlUSE_NETWORK_EVENT=True# Enable network listeningNETWORK_START=True# Use network events to start trials (instead of spacebar)# Network settingsNETWORK_HOST='localhost'# Host to listen onNETWORK_PORT=4950# UDP port number# Event names (must match what your external app sends)NETWORK_START_EVENT_NAME='start_trial'# JSON event name to trigger recording# Sync settingsNETWORK_SYNC_KEY='t'# Keyboard key for manual syncNETWORK_SYNC_EVENT='triggerPress'# Event name for sync markers
How It Works
1. Network Setup
The recorder creates a UDP listener on the specified NETWORK_HOST and NETWORK_PORT. It listens for incoming JSON messages from external applications.
2. Message Format
External applications should send JSON-formatted strings via UDP:
{"event":"start_trial"}
3. Supported Events
Event Name
Purpose
Response
start_trial (configurable via NETWORK_START_EVENT_NAME)
Starts a recording trial
Sends {"event":"ack_start", "trial": N}
sync
Inserts a synchronization marker in the data
Broadcasts sync to external apps
4. Bidirectional Communication
The recorder can also send messages back to external apps:
- Acknowledgments when trials start
- Sync event notifications
- Custom trial/timestamp data