Real-time adaptive tuning system
A research prototype of the doctoral project Instant Harmonies
Rui Su1 — PhD candidate
Supervisor: Joseph Timoney1 · Co-supervisor: Damián Keller2,3
1 Maynooth University, Maynooth, Ireland · 2 Federal University of Acre, Brazil · 3 Ubiquitous Music Group
This application is the research prototype of Instant Harmonies, a doctoral project investigating real-time adaptive just intonation for keyboard performance, situated within the ubiquitous-music (Ubimus) research agenda. As a performer plays, the system infers the prevailing tonal centre — through a neural harmonic-context model, a classical key-profile ensemble, and optionally score-informed alignment against an identified piece — and retunes every note to 5-limit just-intonation ratios within a millisecond-scale budget. Key changes are continuity-anchored so that sounding pitches do not shift audibly, and tuning is delivered through a multi-protocol architecture (MTS, MPE, and MIDI 2.0) that trades resolution against device compatibility. The prototype runs natively in the browser via the Web MIDI API; the controls below expose every detector and transport for controlled comparison.
Routes MIDI between the instrument and the tuning engine. External MIDI returns retuned events to a hardware or software synthesiser in real time; Internal Sound renders through the browser's Web Audio sampler (Salamander grand piano) with no external equipment. Local Control Off (CC 122) prevents a self-routed keyboard from sounding its own untuned keybed alongside the retuned stream.
The core of the system: incoming notes are retuned to 5-limit just intonation relative to the prevailing tonal centre, within a sub-10 ms processing budget. Key changes are continuity-anchored — the retuning offset is chosen so that pitch classes currently sounding do not move, and the syntonic comma falls on scale degrees whose harmonic function has genuinely changed. Tuning is transmitted either as MTS Scale/Octave SysEx (MIDI Tuning Standard; table-based, 0.0122-cent resolution) or as MPE per-note pitch bends on fifteen member channels with sustain-aware voice management.
The optional two-stage score-aware subsystem. Stage 1 identifies the piece from an n-gram fingerprint of the opening notes, matched against an ATEPP-derived database of classical repertoire; Stage 2 aligns the live performance to the identified score in real time and supplies score-informed key context and predictive per-note tuning. Both stages act only under the Auto key-source policy; if identification fails or the piece is unknown, performance continues score-free without interruption.
Captures the performance together with its tuning decisions (key segments, sources, and continuity-anchored tables) and exports it for offline rendering or analysis: MIDI 1.0 MTS embeds one Scale/Octave SysEx table per key segment; MIDI 1.0 MPE writes per-note pitch bends with sustain-aware channel allocation, mirroring the live MPE path byte-for-byte; MIDI 2.0 uses per-note Pitch 7.25; the raw 12-TET reference is note-identical but untuned, for controlled ET-versus-JI A/B comparison.
Offline counterpart to the live engine: applies the same 5-limit just-intonation tuning to an uploaded standard MIDI file, with automatic multi-segment key detection or a fixed manual key, and exports in the same formats as the recorder. Useful for preparing controlled stimuli and for tuning existing repertoire without a live performance.
Mirrors the engine's diagnostic log — key changes and their sources, continuity-anchor offsets, MPE channel allocation and voice stealing, MTS table transmissions, and transport events — for observability during experiments and demonstrations.