Welcome to %s forums

BrainModular Users Forum

Login Register

How about NRPN support?

Tell us what you'd like Usine to do
Post Reply
goyya76
Member
Posts: 69
Contact:

Unread post by goyya76 » 13 Feb 2008, 23:06

The title says it all....

User avatar
senso
Site Admin
Posts: 4424
Location: France
Contact:

Unread post by senso » 14 Feb 2008, 09:06

Actually, the MIDI engine is NRPN compatible;
The problem is to manipulate 14bits data's;
Usine does't contains yet bit manipulation operators like BIT AND, BIT OR, etc.
So For that we need to create small scripts;
Especially some thing to transform 32bit float data's into 14bit int.
Easy to create;
The other problem is that I don't have any NRPN hardware device, so I cant do it my self.
Any candidate?

goyya76
Member
Posts: 69
Contact:

Unread post by goyya76 » 14 Feb 2008, 11:22

woo...i have a Behringer REV2496 which works with NRPN (so i guess i'll be candidate #1), but actually i'm not very expert of floats/integers etc - i suppose the idea is:

- receiving NRPN: combine two 7bit CCs in a 14bit number, then convert it to a float parameter that can be interpreted/assigned into Usine
- sending NRPN: well, the opposite!

i could look into the scripts documentation and try to build one, or (easier for me!) if you already have a draft script i can see what comes out....

Ciao,

Goyya

User avatar
senso
Site Admin
Posts: 4424
Location: France
Contact:

Unread post by senso » 14 Feb 2008, 12:43

In fact it's more simple than it looks.
Here is a set of patches to handle NRPN (can be adapted for RPN)

Data to NRPN: converts data (from 0 to 16119) to NRPN midi messages
NRPN to Data: converts NRPN midi messages to data

and a test patch: as I can't really test NRPN at home, it's just a debug patch.

http://www.sensomusic.com/download/examples/NRPN.zip

This pack is a good starting base, but has to be tested, and probably modified to fit to the general purpose.

If you obtain good results, post an add-on?

goyya76
Member
Posts: 69
Contact:

Unread post by goyya76 » 14 Feb 2008, 14:56

yes of course!

User avatar
nay-seven
Site Admin
Posts: 5684
Location: rennes France
Contact:

Unread post by nay-seven » 14 Feb 2008, 17:58

strange don't see any cc6 or 38 in your patch...? how can you modulate the NRPN without them..?
and you stop to 16119 , not 16383...?

i came from synthedit world ...maybe the problem or..?

ho , and for info senso your bcr2000 can handle NRPN i think..;-)

goyya76
Member
Posts: 69
Contact:

Unread post by goyya76 » 14 Feb 2008, 18:28

nay-seven wrote:ho , and for info senso your bcr2000 can handle NRPN i think..;-)
I confirm it, i have it too - i made a program to control my REV2496 (which uses NRPNs) and it worked flawlessly (actually i used the BCEditor from the BCR/F yahoo group people) - however, i opened this thread: http://www.sensomusic.com/forums/viewtopic.php?id=715 (nay-seven surely remembers!) because i'd like to build an interface to have visual feedback from the rev2496 and stop scrolling the pages on that small display...

User avatar
senso
Site Admin
Posts: 4424
Location: France
Contact:

Unread post by senso » 14 Feb 2008, 18:56

and you stop to 16119 , not 16383...?
yes you're right:
128x128-1 = 16384 and not 16119!

so you have to modify patches and change 16119 into 16384.
ho , and for info senso your bcr2000 can handle NRPN i think..;-)
thanks for the info, I'll take a look.

User avatar
senso
Site Admin
Posts: 4424
Location: France
Contact:

Unread post by senso » 14 Feb 2008, 20:50

the previous version doesn't work
here is a link to the second version of NRPN data patches

http://www.sensomusic.com/download/examples/NRPN2.zip
tested on my BRC200

User avatar
nay-seven
Site Admin
Posts: 5684
Location: rennes France
Contact:

Unread post by nay-seven » 16 Feb 2008, 21:07

i've done an other way for you
you'll have to use nrpn calculator in midiox ( http://www.midiox.com/ )
cause i don't find a direct way ( if someone can help to do same as the calculator of midiox...i don't have understand your way senso... )

i've done a little example fot the preset Theater , you can find it here :
http://nay-seven.com/beta/REV2496_theater.rar

you'll have to place " send NRPN.pat " in your patch folder and run the workspace

if this work for you ( work with my korg es-1 ) i' ll upload the patch in the addons section if this can be usefull for someone...

edit : of course you have to adapt the mini/maxi values of the knob ( ex : DRY knob = 0....71 )

User avatar
nay-seven
Site Admin
Posts: 5684
Location: rennes France
Contact:

Unread post by nay-seven » 16 Feb 2008, 23:34

ok , senso , think i've found for your " data value to nrpn "
it's the " var msb " who seems buggy , very strange , if i delete it , replace by an other variable math module , works !!!

try with data = 0 must give msb =0 , lsb = 0
with data = 127 , msb and lsb must be 127 ,

not with your version !!
gone to propose you an other version of my patch...

User avatar
nay-seven
Site Admin
Posts: 5684
Location: rennes France
Contact:

Unread post by nay-seven » 17 Feb 2008, 00:46

here it is :
http://nay-seven.com/beta/send_NRPN_test.pat

if someone can test on an other machine....

User avatar
senso
Site Admin
Posts: 4424
Location: France
Contact:

Unread post by senso » 17 Feb 2008, 10:12

cool I'll take a look.

magickz
Member
Posts: 75
Contact:

Unread post by magickz » 08 Feb 2016, 11:41

Now I am trying the same with my Novation Nova and DSI Mopho. Actually I try to rebuild these:

NOVA Control VST: http://graywolf2004.net/wp/?page_id=21 (32 bit only, with some glitches in the interface, I want to run it in Usine 64 bit)
MOPHO Sound Editor: http://www.soundtower.com/mopho/ (for my taste it is too expensive, and I would prefer to build my own, if possible in Usine)

Would be great to have an Usine patch to control all parameters and to read out all current parameter settings to display them in Usine Hollyhock 2. But, I guess I need some coaching. Changing parameters in the "Midi Controller Table" from the user manual works so far with CreateMidi. But, when it comes to use the NRPN or "Packed NRPN" tables in the user manual, I still do not understand what it is all about. Using Nay-Seven's patch from above changes something. But I am not sure if I use it correctly and I have no idea what is MSB and LSB and where to put them. :o)

Does someone have an idea where I can start reading more about it to fill my knowledge gap?

User avatar
oli_lab
Member
Posts: 1263
Location: Brittany, France
Contact:

Unread post by oli_lab » 09 Feb 2016, 00:15

Hi,
I made a arduino toy that convert midi to OSC,
here is the part that handle the CC and NRPN

the BCF2000 make use of running status,

Code: Select all

void handleControlchange(byte channel, byte CCnum, byte value)
{
  if (CCnum == 99) {
    //isNRPN = 1;
    NRPN[0] = channel;
    NRPN[1] = value;
  }
  else if (CCnum == 98) {
    //isNRPN = 1;
    NRPN[2] = value;
  }
  else if (CCnum == 6){ //  && isNRPN == 1) {
    NRPN[3] = value;
  }
  else if (CCnum == 38){ // && isNRPN == 1) {
  send3integers&#40;oscAdrMinNRPN, NRPN&#91;0&#93;, NRPN&#91;1&#93; << 7 | NRPN&#91;2&#93;, NRPN&#91;3&#93; << 7 | NRPN&#91;4&#93;&#41;;
  &#125;
  else &#123;
    send3integers&#40;oscAdrMinCC, channel, CCnum, value&#41;;
  &#125;
http://oli-lab.org

Win11 Ryzen9/32GB RAM - RME MADIFACE - SSL alpha link 4-16 - OSC capable interfaces

follow OLI_LAB adventures on Mastodon
@olivar_premier@mastodon.social

magickz
Member
Posts: 75
Contact:

Unread post by magickz » 10 Feb 2016, 16:58

I guess I have to learn C++ to understand it :)

User avatar
oli_lab
Member
Posts: 1263
Location: Brittany, France
Contact:

Unread post by oli_lab » 10 Feb 2016, 18:41

ok !
when the midi nrpn is send by the BCF, for exemple.
4 controlers are send in sequence, no other controlers are send during this time.

so all you have to do is first detect when CC99 is received,
as it is the first data from a NRPN, the value of this CC is put into a temporary buffer NRPN[0]

then the same for CC98 and the 2 last ones...

then, the NRPN 14 bit number will be NRPN[0]<<7 | NRPN[1]
and its value will be NRPN[2]<<7 | NRPN[3]
http://oli-lab.org

Win11 Ryzen9/32GB RAM - RME MADIFACE - SSL alpha link 4-16 - OSC capable interfaces

follow OLI_LAB adventures on Mastodon
@olivar_premier@mastodon.social

User avatar
oli_lab
Member
Posts: 1263
Location: Brittany, France
Contact:

Unread post by oli_lab » 23 Feb 2016, 16:04

Hi,
I'm working on it

I made a module but I have trouble when moving more than one NRPN knob on the BCF2000...

this is what happens :

the NRPN is a set of 4 CC that are send in sequence : CC#99, CC#98,CC#6,CC#38

when moving 2 faders at a time, the BCF sends 2 sets of 4 CC, I suppose it is too fast for Usine because what's going out of the outputs of my module is far less messages.

My guess is Usine does not have time to process the incoming CC before another one is coming on the midi input

I made a similar programe on an arduino that translate midi to OSC and I don't have this malfonction.
Arduino is much slower but has a buffer on the input of the midi in...so it can process all messages.

Could it be it ?

should I make a buffer that fills from a callback on the midi input of the module and is emptied by the sorting algorithm inside the "onProcess" ????

Code: Select all

void MIDINRPNfilter&#58;&#58;onProcess &#40;&#41; 
&#123;
    int sizeMidiIn = sdkGetEvtSize &#40;midiIn&#41;;
	sdkSetEvtSize&#40;midiOut, 0&#41;;


    if &#40;sizeMidiIn > 0&#41;
    &#123;
        //sdkCopyEvt &#40;midiIn, midiOut&#41;;
	    for &#40;int i = 0; i < sizeMidiIn; i++&#41;
        &#123;
            UsineMidiCode code = sdkGetEvtArrayMidi &#40;midiIn, i&#41;;
           if &#40;code.Msg ==  MIDI_CONTROLCHANGE&#41;
           &#123;
			   if &#40;code.Data1 == 99&#41; &#123;
				   NRPN&#91;0&#93; = code.Channel;
				   NRPN&#91;1&#93; = code.Data2;
				   isNRPN = 1;
			   &#125;
			   else if &#40;code.Data1 == 98 && isNRPN == 1&#41; &#123;
				   NRPN&#91;2&#93; = code.Data2;
			   &#125;
			   else if &#40;code.Data1 == 6 && isNRPN == 1&#41; &#123;
				   NRPN&#91;3&#93; = code.Data2;
			   &#125;
			   else if &#40;code.Data1 == 38 && isNRPN == 1&#41; &#123;
				   NRPN&#91;4&#93; = code.Data2;
				   isNRPN = 0;
				   sdkSetEvtData&#40;nrpnChannel, NRPN&#91;0&#93;&#41;;
				   sdkSetEvtData&#40;nrpnNumber, NRPN&#91;1&#93; << 7 | NRPN&#91;2&#93;&#41;;
				   sdkSetEvtData&#40;nrpnValue,  NRPN&#91;3&#93; << 7 | NRPN&#91;4&#93;&#41;;
			   &#125;
			   else &#123;
					sdkSetEvtSize&#40;midiOut, 1&#41;;
					sdkSetEvtArrayMidi&#40;midiOut, 1, code&#41;;
			   &#125;
           &#125;
        &#125;
    &#125;
&#125;
http://oli-lab.org

Win11 Ryzen9/32GB RAM - RME MADIFACE - SSL alpha link 4-16 - OSC capable interfaces

follow OLI_LAB adventures on Mastodon
@olivar_premier@mastodon.social

ceasless
Member
Posts: 330
Contact:

Unread post by ceasless » 23 Feb 2016, 23:10

When you turn two knobs at once, I could imagine that the MIDI messages arrive as a multiplexed stream (99,99,98,6,98,6,38,38, or any mixture thereof). If you add some debugging print statement to print out the cc ('cc is 99;is NRPN is 0', 'cc 98; isNRPN is 1', etc), do they ever arrive out of order?

User avatar
oli_lab
Member
Posts: 1263
Location: Brittany, France
Contact:

Unread post by oli_lab » 23 Feb 2016, 23:17

Hi,
no, they arrive in sequence,
I set a different channel on 2 controllers:
CC99...ch2
CC98...ch2
CC6.....ch2
CC38...ch2
CC99...ch1
CC98...ch1
CC6.....ch1
CC38...ch1
http://oli-lab.org

Win11 Ryzen9/32GB RAM - RME MADIFACE - SSL alpha link 4-16 - OSC capable interfaces

follow OLI_LAB adventures on Mastodon
@olivar_premier@mastodon.social

Post Reply

Who is online

Users browsing this forum: No registered users and 90 guests