Midi NRPN and Bank Tempo

RichG
Posts: 255
Joined: Mon Nov 24, 2014 8:19 am
Has thanked: 1 time

Midi NRPN and Bank Tempo

Post by RichG »

I recently explored the possibility of using a Midi CC to control Bank Tempo. The control was rather course since the tempo range is from 60 to 300 BPM and the CC range is from 0 to 127. Fortunately, DMXIS is capable of handling NRPN. There's not much in the manual about it other than saying it's capable of recognizing NRPN.

If you don't know what NRPN, here's a short explanation: NRPN is a sequence of four CC's that allow control over 16384 parameters with a value range of 0-16383... Compared to a single CC that allows control over 128 parameters with a value range of 0-127.

Here's the long of it...

What is this 'Magic Sequence' of four CC's?
It's CC# 99, 98, 6, 38
or in hex it's 0x63, 0x62, 0x06, 0x26

The values of these CC's are defined as:
0x63 = MSB of NRPN parameter
0x62 = LSB of NRPN parameter
0x06 = MSB of value
0x26 = LSB of value

What are MSB and LSB? They are the Upper (MSB) and Lower (LSB) 7-bits of the numbers. For example:

Given the decimal number 8765, what are the 7 bit MSB and LSB values?
* Convert to Hex
* Convert to Binary
* Define the lower 7-bits as the LSB and the next 7 bits above that as MSB
* Convert those 7-bit numbers into Hex
* Convert those into Decimal

8765 = 0x223D = 0010 0010 0011 0111 = 00 [10 0010 0] [011 0111] = [MSB] [LSB] = [0100 0100] [0011 0111] = [0x44] [0x3D] = [68] [61]

Let's take a real DMXIS example. Let's assign a NRPN to Bank Tempo then set that tempo to 123.456.

Tempo range is 60 - 300
NRPN range is 0 - 16383 (16384 different values)

Use slope of a line formula:

y = m*x + b

or

y = (300 - 60)/(16384) * x + 60

solve for 'x' gives

x = ( y - 60)*16384 / 240

or

NRPN Value = (Tempo - 60)*16384 / 240 = (123.456 - 60)*16384 / 240 = 4331.67

This number must be an integer so let's round up to 4332

Converting this to 7-bit MSB & LSB values gives:

4332 = 0x10EC = 0001 0000 1110 1100 = 00 [01 0000 1] [110 1100] = [MSB] [LSB] = [0010 0001] [0110 1100] = [0x21] [0x6C] = [33] [108]

If NPRN #286 on Midi Channel 14 is assigned to Bank Tempo and we want to set that tempo to 123.456, the Magic CC sequence would be:
BD 63 02 BD 62 1E BD 06 21 BD 26 6C

Changing the tempo to 160 BPM gives:
BD 63 02 BD 62 1E BD 06 35 BD 26 2B

Changing the tempo to 144 BPM gives:
BD 63 02 BD 62 1E BD 06 2C BD 26 66