Cantabile now supports a new MIDI filter that supports decoding HUI switch messages.

About HUI Switch Messages

The HUI spec encodes button presses using two CC messages and uses a concept of zones and ports. A zone typically represents a group of buttons such as a channel strip while a port represents a particular button in that zone. Each zone has 8 ports and there are about 30 defined zones.

When a button on a HUI device is pressed, it first sends the button’s zone in CC 15 (0Fh) followed by the port number and state combined in CC 47 (2Fh). The lower 3 bits define the port number and the highest bit is set when pressed (or on) and cleared when the button is released (or off).

So, for example, the Play button is defined as port 4 on zone 14 and would be transmitted as

B0 0F 0E B0 2F 44  (zone 14, port 4, pressed)
B0 0F 0E B0 2F 04  (zone 14, port 4, released)

Cantabile’s bindings mechanism doesn’t support this kind of event — in particular encoding the button number and button state in the one CC event.

Cantabile’s HUI Switch Decoder

To solve this Cantabile has a new MIDI filter that decodes these HUI style events into a set of typical CC button messages. I considered a few different ways of converting these events but in the end decided to simply map each button to a CC as follows:

CCNumber = zoneNumber * 8 + portNumber

When pressed value of 127 is sent, when released 0. ie: a standard MIDI button style behaviour.

For example: zone 14 port 4 would be mapped to 14 * 8 + 4 = CC #116.

You’ll also notice that the filter has a target channel. This allows you to decode these events into an array of CC controllers that won’t conflict with other CC events that the same device might be sending.

eg: if your keyboard is sending on channel 1, you can decode the HUI events onto channel 2 and the other CC’s on channel 1 will pass through as per normal.

Finally, if you’ve been paying attention you’ll notice that there aren’t enough CC numbers to cover the full range of zones.

eg: zone 29 button 3 would map to CC 235 — which doesn’t exist.

In this case the CC numbers wrap around and the next channel number is used. In other words if the target channel was set to 2, this event would go to channel 3, CC 107 (107 = 235–128).

To Complicated! Just tell me how to use it.

If the above is a bit baffling, here’s the simpler version…

The idea is to put this MIDI filter on the MIDI port (Options -> MIDI Ports -> double click port -> MIDI Filters). This way HUI events will be decoded before the bindings are processed and you can then simply use Cantabile’s MIDI monitor, or the binding learn feature to figure out which CC and channel the button maps to.

This is available now in Cantabile build 3167.