MIDI-OX User Forum (http://www.midiox.com/cgi-bin/yabb/YaBB.pl)
MIDI-OX >> Scripting Questions >> MSB, LSB convert to NRPN
(Message started by: fcromek0 on Jun 18th, 2022, 10:53am)

Title: MSB, LSB convert to NRPN
Post by fcromek0 on Jun 18th, 2022, 10:53am
How i can convert MSB(CC00)+LSB(CC32) = (Banks) to NRPN in MidiOX ?? I can see Bank on "MIDI Status" window but I would like to see the same in column "NRPN".

Title: Re: MSB, LSB convert to NRPN
Post by Breath on Jun 19th, 2022, 2:25am
I'm not quite sure what you want to do but...
MSB = (Bank) CC0 change to (NRPN) CC 99
LSB = (Bank) CC32 change to (NRPN) CC 98

Treat the message conversion of Bank to NRPN as two separate mapping lines (a map can have multiple lines) - that is two separate CC conversions.

CC0 to CC99
CC32 to CC98

I hopes that help
All the best
Royce

Title: Re: MSB, LSB convert to NRPN
Post by fcromek0 on Jun 19th, 2022, 8:55am
Thx it's works great, but now i can't change bank to control NRPN. For example, if we have in "Translation Map":

* Ctrl 0   0   * *  * Ctrl 99 99 * *
* Ctrl 32 32 * *  * Ctrl 98 98 * *

Now i see NRPN (1056) number in "Midi status", but if i add new line in "Translation Map" which changes the bank number (CC00 - MSB) to 82 it doesn't want to change it:

* NRPN 1056 1056 * *  * Ctrl 0 0 82 82

What am I doing wrong ??


Title: Re: MSB, LSB convert to NRPN
Post by Breath on Jun 19th, 2022, 9:59pm
OK, you probably know all this, but  lets start at the beginning to make sure we are on the same page...

Midi started out with the ability to select 128 different patches. More than enough?
Banks were developed because 128 patches was not enough.
How many banks do we need then?
Lets not take any risks. Lets have the ability to have a lot of banks.
Using MSB and LSB means you can have a possible 16,383 banks of 128 patches.

How do we do it? Use CC messages.

CC messages contain three parts
Status byte CC  which is 'this is a CC message' and the MIDI channel built into the same number.
This is followed by two pieces of data
Data 1 is what type of CC this message is
Data 2 the value
(In Midi data is always between 0 to 127 and Status is always 128 to 255)

Bank change works by using two CC messages
CC Type Value
CC   0     Most Significant Byte (MSB) of the value, say 5
CC 32     Least Significant Byte (LSB) of the value, say  8
so
CC channel 1 Type=0   Value=5
CC channel 1 Type=32 Value=8

The Bank number is built from the MSB and the LSB and a bit of arithmetic is needed to assemble the full number
Bank number = (MSB x 128) + LSB  
= 8 x 128 + 5
= 1024 + 5
= 1029
Send this message to your synth and you have now selected the Bank of patches (nothing will have changed on your synth  that you can see or hear)

A bank is like a cupboard of instruments.
Selecting a bank ...
1) Closes the doors of your current bank/cupboard and you can't select anything in there now (until you send another bank message to re-select it).
2) Moves you to the correct cupboard
3) Opens the doors of the new cupboard so you can select whatever is in there.

But you haven't selected anything yet....
You need to select a patch with a Patch Change message on the same channel.
PC 34  (only a Status byte and one Data byte in a patch change message as there are only 128 patches available - 0 to 127 )
Now the patch on your synth is patch 34 in bank 1029

So each Midi channel has a patch bank open - where there can be up to  of 128 sounds available and you can choose a patch for this channel just from this bank until you change the bank.
You need 3 Midi messages
Bank MSB
Bank LSB
PC

But once you have selected the bank any Patch in that bank is available by just sending a single PC message.
That is, you don't need to keep sending the Bank MSB and Bank LSB if the Patch you want is in the currently open bank - just the PC message is enough.


NRPN selection works the same way with a MSB and a LSB the only difference is in the CC type used
(this example should be the result of the data map...)
CC Type Value
CC  99    Most Significant Byte (MSB) and the value = 5
CC  98    Least Significant Byte (LSB) and the value = 8
Giving you a NRPN of 1029 in this case
Now that you have selected a NRPN, you need to send a value for it and for than you can send ...

High resolution - can be big numbers - 0 to 16383 by using MSB and LSB again
CC  6 MSB
CC 38 LSB

OR for
Standard resolution 0 to 127 you can use either CC6 or CC38

If you are using the PC message (ie Bank Change then Patch change) you will need to add another line in your data map.
PC to CC6

It is a bit complicated so if you want some help sorting it out let me know exactly what you are trying to do.

All the best
Royce

Title: Re: MSB, LSB convert to NRPN
Post by fcromek0 on Jun 20th, 2022, 10:59am
Thanks for the quick and comprehensive answer  :)
I need Midi OX to remap the sounds from the LSB and MSB banks to other ones, but those that only have the MSB bank.
On MIDI IN I have a signal from MSB, LSB and PC, which I want to convert to NRPN so that I can change the MSB bank (CC00) to another one on this basis, plus the PC timbre with the same number as on the input. This is what mapping looks like:

* Ctrl 0   0   * *  * Ctrl 99 99 * *
* Ctrl 32 32 * *  * Ctrl 98 98 * *

* NRPN 1056 1056 * *  * Ctrl 0 0 82 82
* NRPN 1057 1057 * *  * Ctrl 0 0 83 83
* NRPN 1058 1058 * *  * Ctrl 0 0 84 84

* PC -1 -1 * *  * Ctrl 6 6 -1 -1

Although the NRPN message is displayed in the "Midi status", I cannot call it in the "Translation Map" and change the CC0 banks to other ones in MIDI OUT.

Title: Re: MSB, LSB convert to NRPN
Post by Breath on Jun 23rd, 2022, 12:01am
Hi
If you are really seeing  the yellow * in the input
* Ctrl 0   0   * *   * Ctrl 99 99 * *  
You have the clone function on .
Clone sends out the original Midi message as well and the new mapped message.
One will overwrite the other in the synth as the clone follows the mapped message coming out of MidiOx.

I need Midi OX to remap the sounds from the LSB and MSB banks to other ones, but those that only have the MSB bank.
So you want to change, for example...
INPUT
CC 0 23
CC 32 10
PC 45

OUTPUT
CC 0 82
CC 32 10
PC 45
is this what you want to achieve ???  (examples of input to output are always good to explain what you are trying to do)
If so you only need to change the CC 0 value

From your NRPN numbers it look like you want to map 3 banks to 3 other banks. Something like this...
* Ctrl 0   0  23 25   Ctrl 0 0 82 84     Bank MSB change

With no need to touch the CC32 and the PC messages, I think you should get the MSB bank mapping you need.

Or have I misunderstood what you are trying to do?

Let me know

All the best
Royce

Title: Re: MSB, LSB convert to NRPN
Post by fcromek0 on Jun 24th, 2022, 4:51am
Basically, I have a program which on the MIDIIN that gives me MSB, LSB and CC signals for all channels.

I want to convert it in such way that, for example, banks (MIDIIN), and swap to others but on MIDIOUT I have a program that only sees MSB and PC:

MIDIIN

MSB=104  
LSB=1
PC=10                  

after conversion (MIDIOUT)

MSB=2
PC=10

-------

MIDIIN

MSB=104
LSB=2
PC=10

after conversion (MIDIOUT)

MSB=3
PC=10

-------

MIDIIN

MSB=104
LSB=3
PC=10

after conversion (MIDIOUT)

MSB=4
PC=10

-------

Therefore, I needed the NRPN signal because with it I have a bank in higher resolution by giving CC98 and CC99 and by giving it in "Data Mapping" I wanted to change the MSB at the output according to the rules

* Ctrl 0   0   * * Clone * Ctrl 99 99 * *
* Ctrl 32 32   * * Clone * Ctrl 98 98 * *

* NRPN 13313 13313 * *  * Ctrl 0 0 2 2
* NRPN 13314 13314 * *  * Ctrl 0 0 3 3
* NRPN 13315 13315 * *  * Ctrl 0 0 4 4

* PC -1 -1 * *  * Ctrl 6 6 -1 -1

Unfortunately, nothing changes at the MIDI OUT output, I don't know where I am making a mistake.


Title: Re: MSB, LSB convert to NRPN
Post by Breath on Jun 27th, 2022, 12:58am
Ok

MSB=104    
LSB=1
PC=10    
after conversion (MIDIOUT)  
MSB=2
PC=10

So is it LSB x -> MSB x+1
You can do that by cheating with the value range. (no clone)

* Ctrl 32 32 0 127   Ctrl 0 0  1 126

Perhaps what you want to do 'if MSB = 104 then do this change... LSB x -> MSB x+1'
Unfortunately there is no conditional functions in the data map.

Were you thinking that if you combine the MSB and LSB to NRPN you can use that NRPN range filter for the conditional function?

Change
MSB=104    
LSB=1
to
NRPN 3401 (sort of a combined Midi message)

* Ctrl  0   0 104 104   Ctrl 99 99  * *
* Ctrl 32 32   0  126   Ctrl 98 98  1 127
* PC  *  *    Ctrl 38 38  * *  this MSB  of the NRPN data
* PC  *  *    Ctrl  6   6  * *  this LSB  of the NRPN data

The result is displayed as a NRPN

I couldn't get it to convert back to the Bank properly.
I think that you will have to write a script.

All the best
Royce



Title: Re: MSB, LSB convert to NRPN
Post by fcromek0 on Jun 27th, 2022, 6:45am
Thanks for the answer :) So I already know that I will not do it in "Data Mapping".
What this sample script should look like ??
I haven't written any scripts in MidiOX yet.
Best Regards

Title: Re: MSB, LSB convert to NRPN
Post by Breath on Jul 2nd, 2022, 7:50pm
I was hoping someone else would step in here.
I'm afraid I haven't had the need to write a script as I code Midi pretty well in C++.

There are script examples in various computer languages that were installed when you installed MidiOx .
That is where I would start.

What would you be writing the script in ?

Royce

Title: Re: MSB, LSB convert to NRPN
Post by fcromek0 on Jul 9th, 2022, 10:47am
Is there anyone willing to write such a script ??
I don't know how to start  :-/

Title: Re: MSB, LSB convert to NRPN
Post by Breath on Jul 11th, 2022, 12:53am
Hi
before I start on a jScript for you, I am still unsure about some things in the Input and Output?

MIDIIN
MSB=104    
LSB=1
PC=10    

after conversion (MIDIOUT)  

MSB=2
PC=10



Is the output message just
MSB_out = LSB_in + 1
PC_out    = PC_in
?

Does the MSB message coming in have no use?

Is this another example of what you expect?


MIDIIN
MSB=82    
LSB=76
PC=45    

after conversion (MIDIOUT)  

MSB=77
PC=45


All the best
Royce




MIDI-OX User Forum » Powered by YaBB 1 Gold - SP 1.3.1!
YaBB © 2000-2003. All Rights Reserved.