Published September 8, 2026 | Version v1

Real-Time MIDI Transformer Integration in Pure Data: A Multi-Threaded Architecture for Interactive AI Music Generation

  • 1. ROR icon Aalto University
  • 2. École Nationale Supérieure de l'Électronique

Description

In this paper, we introduce a real-time MIDI transformer generative system implemented as a Pure Data external. The system balances the computational demands of transformer inference with the latency constraints of live performance through a multi-threaded architecture, a dual-buffer management system with adaptive sliding window mechanisms, and immediate generation triggering that avoids the delays built into polling-based approaches. In practice, it reaches 361ms average (CPU) end-to-end latency while maintaining 82% harmonic correlation between live input and generated output (4.2× above the random baseline), which appears sufficient for textural and call-and-response playing contexts even if it falls above tight-coupling thresholds. Cross-platform support is handled through ONNX Runtime. On the evaluation side, we introduce input-output correlation analysis across pitch, rhythm, and dynamics as a way of asking what musical intelligence the system is actually demonstrating. The implementation is released as open source and we hope it offers a useful starting point for others working at the intersection of generative AI and real-time music-making.

Files

Real-Time MIDI Transformer Integration in Pure Data - A Multi-Threaded Architecture for Interactive AI Music Generation.pdf