Overview
The TimeCodeExporter receives MIDI Time Code (MTC) from external sources and broadcasts it via UDP to multiple ports. This enables time-based synchronization between HNode and other systems like lighting consoles, media servers, or show control software.Configuration
The name of the MIDI input device to receive timecode from. Must match the exact device name as it appears in the system.
YAML Example
UDP Broadcast
The exporter automatically broadcasts timecode data to multiple UDP ports on localhost (127.0.0.1):- Port 7001
- Port 7002
- Port 7003
- Port 7004
- Port 7005
Data Format
Each UDP packet contains 13 bytes:Packet Structure
Timecode in UTC milliseconds (hours, minutes, seconds converted to total milliseconds)
Frame number (0-29 depending on framerate)
Current system UTC time in milliseconds since Unix epoch
Example Packet Parsing
Supported Timecode Formats
The exporter supports all standard SMPTE/MTC framerates:Film standard (24 frames per second)
PAL video standard (25 frames per second)
NTSC drop-frame (29.97 frames per second)
NTSC non-drop (30 frames per second)
MIDI Timecode Types
The exporter handles two types of MIDI timecode:Quarter Frame Messages
Standard MTC quarter frame messages that send timecode incrementally. The exporter reconstructs the full timecode from these messages.Full Frame SysEx
Full frame timecode sent as a System Exclusive message:hh= hours (lower 5 bits) + framerate (upper 3 bits)mm= minutesss= secondsff= frames
Technical Implementation
User Interface
The exporter provides UI controls:Text input to specify the MIDI input device name. Must match system device name exactly.
Manually reconnect to the MIDI device. Useful if the device was disconnected or changed.
Use Cases
Sync with Lighting Console
Receive timecode from a lighting console and use it to trigger HNode automation:Media Server Synchronization
Broadcast timecode to media servers for synchronized video playback:Show Control
Integrate with show control systems that use MIDI timecode as the master clock:Timing Considerations
The UDP packet is sent duringInitFrame() rather than CompleteFrame() to minimize latency. This ensures timecode is broadcast as early as possible in the frame processing cycle.
Latency
- MIDI timecode reception: ~1-2ms
- UDP broadcast: <1ms on localhost
- Total latency: Typically <3ms
Network Configuration
By default, the exporter broadcasts to localhost only. To send to remote machines, modify the source code:Error Handling
The exporter includes error handling for:- Missing MIDI devices
- Disconnected MIDI devices
- Invalid timecode messages
- UDP send failures
Limitations
- Only receives timecode (does not generate or send MTC)
- Fixed UDP port list (requires code modification to change)
- Localhost only by default
- Does not support LTC (Linear Timecode) - MIDI only
Receiving Applications
To receive timecode in your application:- Create a UDP socket listening on one of the five ports (7001-7005)
- Parse the 13-byte packet structure
- Convert big-endian integers to your platform’s native format
- Use the timecode and frame data for synchronization