SkillAgentSearch skills...

Jamrouter

Near-Sample-Accurate JACK <-> Raw MIDI router, Juno-106 SysEx translator, MIDI stream optimizer, synth programming tool, and more! Super low latency. Super low jitter. Benchmark tested for Zero synchronization errors in over 100,000,000 MIDI events. Rx+Tx MIDI latency < 5msec with jitter < 150usec real over-the-wire performance with common PCI-based MPU-401 variants! Flawless MIDI timing for Linux/JACK is finally here!

Install / Use

/learn @williamweston/Jamrouter
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

jamrouter-0.2.3:

JAMRouter: JACK <-> ALSA MIDI Router v0.2.3

JAMRouter is a near-sample-accurate low-latency low-jitter MIDI event router and translator, designed specifically with external hardware in mind, with an initial emphasis on providing full MIDI support and SysEx translation for the Roland Juno-106, and otherwise full compatibility with practically all MIDI hardware. JAMRouter routes MIDI events to/from JACK MIDI software ports and MIDI hardware supported by ALSA Raw MIDI, ALSA Sequencer, Generic Raw MIDI, and OSS MIDI.

JAMRouter is a "must have" for any Linux MIDI musician using external MIDI hardware of any kind, especially analog synthesizers. With the right hardware and a properly tuned linux-rt (realtime) kernel, near-sample-accurate over-the-wire MIDI communication with latencies under 5 milliseconds and jitter under 150 microseconds is fully realizable. JAMRouter has already passed dozens of sample-accurate test results, and the timing continues to improve as development continues. JACK has been in the box too long. Now JACK can reliably communicate with MIDI hardware outside the box. For Juno-106 owners in particular, JAMRouter could very well be reason for switching to Linux!

JAMRouter is design driven, packed full of features, and incredibly stable. More than just a MIDI router, JAMRouter comes with many options for translating MIDI events in real-time, fixing most of the common and several not so common MIDI protocol level communication incompatibilities between outboard MIDI gear and JACK MIDI based software. Beyond that, JAMRouter comes with a few creative-minded MIDI event translation features with optional echo of these translations back to the JACK MIDI output port for sequencer recording, making it a very unique and valuable synth programming tool, with or without external MIDI gear.

For most professional over-the-wire MIDI workloads on Linux, JAMRouter can already serve as a complete replacement for a2jmidid, a2jmidi_bridge, and j2amidi_bridge. To be quite fair, these excellent tools still have their place. The dbus support makes them better suited for general desktop integration, for one. While the sub-jack-buffer-period MIDI timing accuracy of a2jmidid has improved greatly over the years and is now good enough for a lot of people's needs, a2jmidid's timing is still dependent on the accuracy of the ALSA Sequencer direct interface (which at least does bypass most of the overhead of the sequencer queue, but still incurs more overhead than ALSA Raw MIDI, with some code paths leading to extreme jitter corner cases). In older versions of JACK, the accuracy of jack_frame_time() appeared to introduce jitter dependent on JACK wake-up times and/or system load. This problem appears to have been solved quite elegantly in the newer DLL timing equipped versions of JACK. Development on a new JACK DLL based timing solution is currently under way, however JAMRouter will continue to support its own PLL based timing approach so as to remain flexible with other audio and MIDI backends in the future.

JAMRouter is essentially the MIDI transport and timing layer pulled out of PHASEX, fully re-engineered for rock-solid real-time performance, with Rx and Tx fully implemented for all drivers, and fine-tuned from there. As JAMRouter focuses on use with ALSA Raw MIDI, (which unlike ALSA Sequencer performs no event processing), active event processing becomes an absolute necessity for maintaining the widest degree of compatibility between JACK MIDI software and outboard MIDI gear.

For these reasons, JAMRouter no doubt has a slightly different target audience than a2jmidid: Musicians and studio professionals who need reliable timing accurate communication between outboard MIDI gear and JACK applications, and electronic musicians working with JACK enabled sequencers looking for new MIDI sequencing techniques.

If a2jmidid and family work perfectly for your workload, there may be no reason to switch. Whether you currently use a2jmidid or not, you may want to seriously consider JAMRouter if you:

  • work with an electronic music style where timing is everything.

  • are looking to add real-time event translation to your bag of synth programming tricks,

  • are looking for solutions for keyboard controllers leaving hung notes in soft-synths and sequencers due to lack of Note-On/Off, Active-Sensing or All-Notes-Off processing,

  • use MIDI gear with slow MIDI Rx interfaces that need MIDI Tx bandwidth regulation on the computer interface end,

  • happen to own early MIDI / pre-MIDI gear that uses 1- or 2-byte End-SysEx sequences other than the default 0xF7,

  • have any sort of need to view the real-time MIDI stream with MIDI event and JACK wake-up timing information,

  • or if you are the proud owner of a Juno-106.

For timing performance, JAMRouter focuses on use with the ALSA Raw MIDI and Generic Raw MIDI drivers. ALSA Sequencer direct and OSS support are included so that practically any MIDI interface device ever supported in Linux can be routed to JACK MIDI ports with the best possible performance available for that particular hardware. No more games of wrong driver support for MIDI interfaces getting in the way of interfacing with modern JACK MIDI based software.

For JAMRouter/a2jmidid jitter/latency testing results obtained from jack_midi_latency_test with JACK running at 96000 sample rate and audio buffer periods ranging from 64 to 2048, look in doc/latency-tests/. Full testing rounds were conducted with JAMRouter-0.1.9 and two different PCI based MPU-401 MIDI interfaces, a Creative SB-Live (EMU10K1 chip-set) and an M-Audio Delta-1010 (ICE1712 chip-set). All tests were performed with a standard Din-5 MIDI cable connecting the interface's output to its input. Current benchmarks are more than promising, as they show no real-time synchronization errors in over 100,000,000 events at default phase lock and latency settings across all buffer period sizes from 16 to 2048. JAMRouter's timing is rock-solid, with plenty of jitter-latency plots to prove it. The included test results reflect the highest peak jitter for each set of test parameters over the course of 12 hours, and thus should serve as an accurate indication of what can be expected on other systems. Similar results should be obtainable from many modern (and some very old) PCI based MIDI interfaces, especially interrupt driven MPU-401 variants and dual Rx/Tx UART variants. Latency testing scripts are included with the JAMRouter source code in the latency-tests/ directory. For more information, see the LATENCY-JITTER TESTING section below.


CAVEATS:

  • YMMV. Great MIDI performance is dependent on thousands of technical factors. Commercial MIDI hardware varies widely in terms of buffer sizes, latency, jitter, duplex performance, transmission rate, maximum dependable receive rate, voltage, impedance, transmission noise, harmonic distortion, pulse width, bit transmission frequency, byte transmission frequency, MIDI spec implementation, etc.

  • A realtime (-rt) Linux kernel is a strict requirement for professional audio and MIDI in the Linux world. Thankfully, packages are available through alternate repositories for many Linux distributions providing linux-rt kernels, rtirq, and other system tuning tools. Please research what is appropriate for your specific distribution and hardware if you haven't already. Once you switch to -rt, you'll never go back to a vanilla kernel again! JAMRouter is designed as a realtime application, and absolutely no performance guarantees can be made for use under a non-rt kernel. (No performance guarantees can be made for GPL'ed software anyway, but that's a different point.) That being said, whether running on a vanilla or -rt kernel, the system will need to be configured so that all audio and MIDI software is allowed to run at realtime priorities.

  • USB MIDI devices traditionally lack the ability for sub-buffer-period MIDI event scheduling, and thus will exhibit levels of jitter equal to or greater than the audio buffer latency. The MIDI-over-USB standard lacks the event timestamping found in other MIDI transport systems such as MIDI-over-firewire. Most USB MIDI devices internally deliver unscheduled MIDI events once per buffer processing period for both Din-5 Tx and USB output. USB latency adds a minimum of 1 msec to both Rx and Tx latency, and this latency is never guaranteed to be consistent, and for some devices, can be an additional source of jitter. For these reasons, any USB device making use of only the generic MIDI-over-USB standard cannot and will not ever be capable of delivering accurate MIDI timing. Some USB devices are capable of sub-buffer-period event scheduling given the proper drivers. Drivers enabling proprietary features on some of these devices simply do not exist for Linux.

  • Flawless MIDI Rx with the the M-Audio Delta-1010 is impossible with the current ALSA driver. The device appears to have some data bits encoded into one end of it's Rx buffer memory, possibly a proprietary hardware acceleration for MIDI realtime message processing, or else just an end of buffer marker that somehow makes its way into the serial encoder. Without better documentation for the device's proprietary MPU-401 command set (specifically, methods of changing the MIDI Rx/Tx buffer address and/or size, and working with proprietary MPU-401 hardware optimizations), it is highly likely that the Linux driver will never be fixed. On the other hand, Tx on the Delta-1010 is great

View on GitHub
GitHub Stars40
CategoryDevelopment
Updated2mo ago
Forks4

Languages

Shell

Security Score

75/100

Audited on Jan 10, 2026

No findings