This pipeline implements near-instant pattern change for the Digitone and Digitakt. Other devices might also work but were not tested.
How it works
The Digitone / Digitakt responds to Program Change messages i different ways depending on whether the transport is started or stopped.
When the transport is stopped, Program Change messages instantly switch to the pattern marked by the program number.
When the transport is started, Program Change messages queue up the pattern marked by the program number to be played after the currently played pattern is finished.
The pipeline takes the incoming Program Change messages and surrounds them with a Stop and Start message.
A small delay is inserted before the Start message. This delay is necessary and without it the Digitone / Digitakt will not switch patterns reliably.
There is no general delay pipe on the Midihub, so a series of extra pipes are used as a workaround.
The pipeline is triggered via a program change message.
1. a Filter pipe discards everything but Program Change messages
2. a Channel Remap pipe transforms the MIDI channel of the incoming messages to channel 10 (Default AUTO channel on Digitone / Digitakt)
3. a Transform pipe inserts a Stop message before the Program Change message
4. a Transform pipe inserts a Note On message after the Program Change message
5. a Delay pipe delays the Note On message by a few milliseconds
6. a Filter pipe removes the Note Off message that is generated by the Delay pipe
7. a Transform pipe replaces the delayed Note On message with a Start message
Steps 4 to 7 are needed to work around the nonexistent general delay pipe.
The pipeline was designed to work by itself alone.
If the pattern change is not consistent, try increasing the Delay Time of the Delay pipe until a good balance is found.
The Start message is effectively delayed by a few milliseconds so that means if the Digitone / Digitakt is configured as a MIDI clock / transport follower, the playback will also be delayed by the same amount.
In practice this might not make any difference.
Digitone / Digitakt settings
The Digitone / Digitakt TRANSPORT RECEIVE and PROG CH RECEIVE needs to be enabled in the MIDI SYNC settings.
An external clock must be provided or CLOCK RECEIVE needs to be disabled in the MIDI SYNC settings.
Based on RK-002 Digitakt Pattern Switch Arduino Sketch: https://duy.retrokits.com/a7aaf3a0-22a6-4150-94b0-b136e2c87444