Old 10-13-2018, 12:10 PM   #1
rothchild
Human being with feelings
 
Join Date: Oct 2007
Posts: 784
Default MIDI coding guidance, please?

Hi all,

I've finally taken the leap and started trying to write some code, I feel like I've done ok, as a rank amateur, but unsurprisingly it doesn't work and I'm a bit stuck, so I'm hoping I can get a bit of help to get me on the right path.

I think the bigger portion of my issue is that I'm really struggling to understand the MIDI aspect of what I'm trying to do (but I'm confident that my coding is rubbish too!)

I'm trying to make a programmer for my Roland SRV3030, starting with just one parameter (at least I'm trying walk before running).

The spec for the device is here: http://cdn.roland.com/assets/media/pdf/SRV-3030_MI.pdf

If some kind soul could let me know if I'm even in the right woods, let alone barking up the right tree I'd be most grateful.

In particular I'm struggling to understand how to construct the message that should be going to the box (because I'm stuggling to interpret the spec)

The secondary issue is how to put the code together to capture the slider info and update the buffer value (as this doesn't seem to be working - watching the data in ReaControlMidi I don't see anything change when I move the slider).

All advice and guidance gratefully received!

Code:
desc:Roland SRV3030 EZ Edit Midi Control Experiment

//this is the proof of concept version in which I demonstrate my ignorance of coding, maths and midi! 

in_pin:none
out_pin:none

slider1:50<0,100,1>Rev Time A 

@init
ext_noinit = 1; 
buf[0] = 0x50; //Temp program parameter block ofset MSB(? I think, and the next 3 lines..)
buf[1] = 0x00; //offset LSB of parameter block
buf[2] = 0x00; //offset address MSB
buf[3] = 0x0E; //offset address LSB (added to parameter block which is 00)
buf[4] = slider1; //data value (to change parameter setting) - not seeing this change anything...

@slider
//revat = slider1; //do I need to make the slider a variable and then feed that to the buffer or can I just set buf[n] = slider1?

@block
midisend_buf(0,buf,4+1); //the spec says 7 byte message, do I need to make this 5 to deal with the fact 
//that reaper adds sysex send and end (or is it 7 + status bytes)?
rothchild is offline   Reply With Quote
Old 10-14-2018, 11:32 AM   #2
rothchild
Human being with feelings
 
Join Date: Oct 2007
Posts: 784
Default

Feel like I'm getting closer at least (probably not, but it keeps me motivated!)

Thanks to this rather useful little guide: http://www.2writers.com/eddie/TutSysEx.htm

I've ended up with:

Code:
desc:Roland SRV3030 EZ Edit Midi Control Experiment

//this is the proof of concept version in which I demonstrate my ignorance of coding, maths and midi! 


in_pin:none
out_pin:none

slider1:50<0,100,1>Rev Time A 

@init
ext_noinit = 1; 

@slider
//revat = slider1; //do I need to make the slider a variable and then feed that to the data buffer or can I just set buf[n] = slider1?

@block
buf = 100000; //not sure what this value is for, can anyone advise please?
buf[0] = 0x41; //manufacturer ID
buf[1] = 0x10; //device ID - this is apparently arbitary as there's only 1 device
buf[2] = 0x00; //model ID MSB
buf[3] = 0x12; //model ID LSB
buf[4] = 0x12; //command ID
buf[5] = 0x00; //address MSB
buf[6] = 0x00; //address bb
buf[7] = 0x04; //address cc
buf[8] = 0x0E; //address LSB
buf[9] = 0x32; //data - just set to 50 to see if the prgram changes for now, I'll work out the slider later
//buf[10] = 0xnn; //checksum (want to make a funciton for this so it adds up the right bits and 
//changes it according to slider value, is this element mandatory?

midisend_buf(0,buf,10); //the spec says 7 byte message, do I need to make this 5 to deal with the fact 
//that reaper adds sysex send and end (or is it 7 + status bytes)?
At least the string that's coming through reacontrol midi looks like the right sort of thing.

The main bit I'm still not getting is how to interpret some of the stuff in the spec. For instance am I aiming to edit 'program parameters' or the 'temporary program parameters' (page 2), and if it's the latter, which one (they're listed twice with different addresss for some reason (10 00 00 00 and 50 00 00 00))

I appreciate that this must be painful to watch for anyone who actually knows what they're doing, so any help or tips that might set me on the right path are gratefully received.
rothchild is offline   Reply With Quote
Old 10-14-2018, 12:31 PM   #3
Fabian
Human being with feelings
 
Fabian's Avatar
 
Join Date: Sep 2008
Location: Sweden
Posts: 7,431
Default

Just one small piece of the puzzle...

Code:
@block
buf = 100000; //not sure what this value is for, can anyone advise please?
buf[0] = 0x41; //manufacturer ID
buf[1] = 0x10; //device ID
From the manual:
Code:
You may use brackets to index into memory that is local to your effect.
Your effect has approximately 8 million (8,388,608) slots of memory and
you may access them either with fixed offsets (i.e. 16811[0]) or with
variables (myBuffer[5]). The sum of the value to the left of the
brackets and the value within the brackets is used to index memory. If
a value in the brackets is omitted then only the value to the left of
the brackets is used.
So in this case you set your offset to start storing the values at 1000
so that writing to "buf[0]" writes to the memory location 1000, and writing to "buf[1]" writes to memory location 1001, etc.

You basically set the buffer to start at some specific place in memory. This is handy when you want to make sure that arrays do not overlap, for instance, in some code for doing FFT, I coded:

Code:
  BUF_SIZE = 16384;   // Must be at least 2 times max FFT size!
  // Set up the buffers
  window = 0;
  buf1 = window + BUF_SIZE; // buf1 = 16384;
  buf2 = buf1 + BUF_SIZE;        // buf2 = 32768;
  LoBuf1 = buf2 + BUF_SIZE;       // LoBuf1 = 49152;
  LoBuf2 = LoBuf1 + BUF_SIZE;       // LoBuf2 = 65536;
  MidBuf1 = LoBuf2 + BUF_SIZE;
  MidBuf2 = MidBuf1 + BUF_SIZE;
  HiBuf1 = MidBuf2 + BUF_SIZE;       // HiBuf1 = 81920;
  HiBuf2 = HiBuf1 + BUF_SIZE;       // HiBuf2 = 98304;
__________________
// MVHMF
I never always did the right thing, but all I did wasn't wrong...
Fabian is offline   Reply With Quote
Old 10-14-2018, 12:42 PM   #4
rothchild
Human being with feelings
 
Join Date: Oct 2007
Posts: 784
Default

Thanks Fabian!

A timely and relevant intervention, awesome.

I've got the basic premise working now (downloaded the demo of midiquest and spied on the data it was kicking out ;-)

I'm now here:

Code:
desc:Roland SRV3030 EZ Edit Midi Control Experiment

//this is the proof of concept version in which I demonstrate my ignorance of coding, maths and midi! 


in_pin:none
out_pin:none

slider1:50<0,100,1>Rev Time A 

@init
ext_noinit = 1; 

@slider
//revat = slider1; //do I need to make the slider a variable and then feed that to the data buffer or can I just set buf[n] = slider1?

@block
buf = 100000; //not sure what this value is for, can anyone advise please?
buf[0] = 0x41; //manufacturer ID
buf[1] = 0x00; //device ID
buf[2] = 0x00; //model ID MSB
buf[3] = 0x12; //model ID LSB
buf[4] = 0x12; //command ID
buf[5] = 0x50; //address MSB
buf[6] = 0x00; //address bb
buf[7] = 0x00; //address cc
buf[8] = 0x0E; //address LSB
buf[9] = 0x32; //data
buf[10] = 0x70; //checksum (want to make a funciton for this so it adds up the right bits and 
//changes it according to slider value)

midisend_buf(0,buf,11); //sends the command
My next question was going to be about defining the variables for the buffers but I can see you've done that so I'm going to play with that and the maths for calculating the checksum and putting it in a variable.

I'm going to stew on the memory buffer thing for a while, I've not got to arrays yet (I don't think), so as long as they've got somewhere to go for now I'm happy.
rothchild is offline   Reply With Quote
Old 10-14-2018, 05:14 PM   #5
Time Waster
Human being with feelings
 
Time Waster's Avatar
 
Join Date: Aug 2013
Location: Bowral, Australia
Posts: 1,643
Default

Code:
buf = 100000; //not sure what this value is for, can anyone advise please?
The address for the memory location is the sum of the value in front of the square brackets (in this case "buf") and the value inside the brackets. In your previous code you had not set the value of buf so it would have defaulted to 0, which is fine as long as you aren't already using that block of memory. You can assign variables to either the number in front of the brackets, or the number inside the brackets, or both.
__________________
Mal, aka The Wasters of Time
Mal's JSFX: ReaRack2 Modular Synth
Time Waster is offline   Reply With Quote
Old 10-15-2018, 06:54 AM   #6
rothchild
Human being with feelings
 
Join Date: Oct 2007
Posts: 784
Default

Thanks Timewaster, I can see how the buffers really matter for audio processing, I'm not so clear how and when I'm going to come up against them in this project as I'm dealing with comparatively small amounts of data (or maybe that's not the matter!)


For now I'm now after a graceful way to code the checksum calculator, at the moment I've got this:

Code:
//checksum calculator 
sum1 = addmsb + addbb;
sum2 = sum1 + addcc;
sum3 = sum2 + param;
sum4 = sum3 + value;
sum5 = sum4 % 0x80;
sum = 0x80 - sum5;
But it doesn't seem to work as expected, do I have to convert to decimals? (and if so is this what 'sprintf' is for?)

I'm tying to do this(http://www.2writers.com/eddie/TutSysEx.htm):

1. Convert hex to decimal:
40h = 64
11h = 17
00h = 0
41h = 65
63h = 99

2. Add values:
64 + 17 + 0 + 65 + 99 = 245

3. Divide by 128
245 / 128 = 1 remainder 117

4. Subtract remainder from 128
128 - 117 = 11

5. Covert to hex:
11 = 0Bh


But I have a different number of bytes to deal with than any other definition of the checksum that I've cound online, so if anyone has any insight as to whether the method described should still work or not (of if I have to work out the checksum another way) that would be most helpful.
rothchild is offline   Reply With Quote
Old 10-16-2018, 10:03 AM   #7
rothchild
Human being with feelings
 
Join Date: Oct 2007
Posts: 784
Default

I'm still wrestling with this checksum calculator, is it a syntax thing?

Do I need some brackets, or do I need to do something to notify the script that the value of 'value' has changed (when I move the slider) to get it to redo the calculation?

Does it need to be a function?
rothchild is offline   Reply With Quote
Old 10-16-2018, 11:56 AM   #8
Fabian
Human being with feelings
 
Fabian's Avatar
 
Join Date: Sep 2008
Location: Sweden
Posts: 7,431
Default

Quote:
Originally Posted by rothchild View Post
I'm still wrestling with this checksum calculator, is it a syntax thing?

Do I need some brackets, or do I need to do something to notify the script that the value of 'value' has changed (when I move the slider) to get it to redo the calculation?

Does it need to be a function?
If you want to redo the calculation when the slider is moved, one way to do it is in the @slider part of the code. I think this would be the best choice.

Another way is to set a flag in that part of the code so that you in another part of the code (the @block, maybe?) do the recalculation when the flag is set. Don't forget to reset it.

And no, it does not have to be calculated in a function, but you can do that if you want to get the actual calculation out of the way in the source code.

If you uncomment the line after @slider in the code in your original post, and run the code in the editor inside Reaper, you should see the retval variable change its value as you drag slider1.

EDIT: Or maybe I don't understand what the problem is...
__________________
// MVHMF
I never always did the right thing, but all I did wasn't wrong...
Fabian is offline   Reply With Quote
Old 10-16-2018, 11:53 PM   #9
Tale
Human being with feelings
 
Tale's Avatar
 
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,652
Default

Quote:
Originally Posted by rothchild View Post
But it doesn't seem to work as expected, do I have to convert to decimals? (and if so is this what 'sprintf' is for?)
It seems to work just fine here i.e. if I use the example values the result is 11.
Tale is offline   Reply With Quote
Old 10-17-2018, 10:57 AM   #10
rothchild
Human being with feelings
 
Join Date: Oct 2007
Posts: 784
Default

Thanks Fabian and Tale,

I really appreciate your time and patience to help a rookie out.

I probably should have shared where the whole script is up to, I've moved the value variable in to the @slider section but when I move the slider of the byte it's controlling changes but the checksum value stays stuck at 70 (looking at the output in reacontrol midi) likewise if I change the param slider (and then move the value slider) I can see that byte change as expected but again the checksum stays at 70:

Code:
desc:Roland SRV3030 EZ Edit Midi Control Experiment

//this is the proof of concept version in which I demonstrate my ignorance of coding, maths and midi! 

in_pin:none
out_pin:none

slider1:50<0,100,1>Rev Time A
slider2:14<14,33,1>Parameter

@init
ext_noinit = 1; 

manuid = 0x41; //manufacturer ID
devid = 0x00; //device ID
modidmsb = 0x00; //model ID MSB
modidlsb = 0x12; //model ID LSB
comid = 0x12; //command ID
addmsb = 0x50; //address MSB
addbb = 0x00; //address bb
addcc = 0x00; //address cc
//param = 0x0E; //address LSB - this is the parameter (within ez edit) to be edited - taken out as defined with slider
//value = slider1; //data - parameter value - taken out as defined as part of slider

//checksum calculator (add items together, divide by 128 and subtract remainder from 128)
sum1 = addmsb + addbb;
sum2 = sum1 + addcc;
sum3 = sum2 + param;
sum4 = sum3 + value;
sum5 = sum4 % 0x80;
sum = 0x80 - sum5; 

@slider
value = slider1;
param = slider2;

@block
buf = 100000; //sets start point and size of memory address
buf[0] = manuid; //manufacturer ID
buf[1] = devid; //device ID
buf[2] = modidmsb; //model ID MSB
buf[3] = modidlsb; //model ID LSB
buf[4] = comid; //command ID
buf[5] = addmsb; //address MSB
buf[6] = addbb; //address bb
buf[7] = addcc; //address cc
buf[8] = param; //address LSB
buf[9] = value; //data
buf[10] = sum; //checksum (want to make a funciton for this so it adds up the right bits and 
//changes it according to slider value)

value != valold ? (
midisend_buf(0,buf,11); //sends the command
valold = value; //I borrowed this bit from PS to slider as it seems to stop the constant stream of data but I'm not sure if it's interfering with my checksum calc?
);

EDIT: Ah, the power of posting ones ingnorance to the internet! I've moved the checksum calc to @block and now it seems to work! That's one step forward, what will the inevitable two steps back be this time?!

EDIT2: Whilst it 'works' in the sense that the checksum bit is now being recalculated with slider moves the results appear to be wrong (and inconsistent) - all thoughts and suggestions as to how to make it work properly gratefully received!

Last edited by rothchild; 10-17-2018 at 11:28 AM. Reason: Acknowledge my own stupidity!
rothchild is offline   Reply With Quote
Old 10-17-2018, 11:51 AM   #11
rothchild
Human being with feelings
 
Join Date: Oct 2007
Posts: 784
Default

Ok, well a crude hack has, for now, fixed the checksum calculator and I've achieved my first major programming milestone - the little widget for reverb time in my hardware box now moves up and down in (more or less) sync with slider I've coded in Reaper!

My proof of concept is proven, I can do this.

Code:
desc:Roland SRV3030 EZ Edit Midi Control Experiment

//this is the proof of concept version in which I demonstrate my ignorance of coding, maths and midi! 

in_pin:none
out_pin:none

slider1:50<0,100,1>Rev Time A
//slider2:14<14,33,1>Parameter

@init
ext_noinit = 1; 

manuid = 0x41; //manufacturer ID
devid = 0x00; //device ID
modidmsb = 0x00; //model ID MSB
modidlsb = 0x12; //model ID LSB
comid = 0x12; //command ID
addmsb = 0x50; //address MSB
addbb = 0x00; //address bb
addcc = 0x00; //address cc
param = 0x0E; //address LSB - this is the parameter (within ez edit) to be edited - taken out as defined with slider
//value = slider1; //data - parameter value - taken out as defined as part of slider

@slider
value = slider1;
//param = slider2;

@block
buf = 100000; //sets start point and size of memory address
buf[0] = manuid; //manufacturer ID
buf[1] = devid; //device ID
buf[2] = modidmsb; //model ID MSB
buf[3] = modidlsb; //model ID LSB
buf[4] = comid; //command ID
buf[5] = addmsb; //address MSB
buf[6] = addbb; //address bb
buf[7] = addcc; //address cc
buf[8] = param; //address LSB
buf[9] = value; //data
buf[10] = sum - 1; //checksum 

//checksum calculator (add items together, divide by 128 and subtract remainder from 128)
sum1 = addmsb + addbb;
sum2 = sum1 + addcc;
sum3 = sum2 + param;
sum4 = sum3 + value;
sum5 = sum4 % 0x80;
sum = 0x80 - sum5; 

value != valold ? (
midisend_buf(0,buf,11); //sends the command
valold = value; //I borrowed this bit from PS to slider as it seems to stop the constant stream of data
);
If I move the slider too quickly, or double click it things get a bit funky (the hardware reports midi recieve errors and the checksum number don't add up right).

I'm also now after some architecture advice, as I now want to expand this to multiple sliders for more parameters, what's the best way to recycle as much code as possible (as the bulk of the midi message is the same, generally the param and value values are the only ones that change). So I need the parameter value to be a multiple variable based on the slider that is used, but I also need to extract a value from the slider, how would I do this?

Also, any tips on beating the 16 slider limit as there are many, many more parameters in this piece of hardware and I'd like to address (nearly) all of them?
rothchild is offline   Reply With Quote
Old 10-17-2018, 12:28 PM   #12
Fabian
Human being with feelings
 
Fabian's Avatar
 
Join Date: Sep 2008
Location: Sweden
Posts: 7,431
Default

Try something like this (untested code, but still...)

Code:
desc:Roland SRV3030 EZ Edit Midi Control Experiment

//this is the proof of concept version in which I demonstrate my ignorance of coding, maths and midi! 

in_pin:none
out_pin:none

slider1:50<0,100,1>Rev Time A
//slider2:14<14,33,1>Parameter

@init
ext_noinit = 1; 

manuid = 0x41; //manufacturer ID
devid = 0x00; //device ID
modidmsb = 0x00; //model ID MSB
modidlsb = 0x12; //model ID LSB
comid = 0x12; //command ID
addmsb = 0x50; //address MSB
addbb = 0x00; //address bb
addcc = 0x00; //address cc
param = 0x0E; //address LSB - this is the parameter (within ez edit) to be edited - taken out as defined with slider

// This only needs to be done once (by the looks of it)
buf = 100000; //sets start point and size of memory address
buf[0] = manuid; //manufacturer ID
buf[1] = devid; //device ID
buf[2] = modidmsb; //model ID MSB
buf[3] = modidlsb; //model ID LSB
buf[4] = comid; //command ID
buf[5] = addmsb; //address MSB
buf[6] = addbb; //address bb
buf[7] = addcc; //address cc
buf[8] = param; //address LSB

sendmidi = 0; // Used to tell @block when to send out midi

//checksum calculator (add items together, divide by 128 and subtract remainder from 128)
function calc_checksum(value)
(
	0x80 - ((addmsb + addbb + addcc + param + value) % 0x80); 	
);

@slider
value = slider1;
value != buf[9] ? // buf[9] holds the old value
(
	buf[9] = value;
	buf[10) = calc_checksum(value);
	sendmidi = 1;
);

@block
sendmidi ? 
(
	midisend_buf(0,buf,11); //sends the command
	sendmidi = 0; 
);
Something like that. Maybe...
__________________
// MVHMF
I never always did the right thing, but all I did wasn't wrong...
Fabian is offline   Reply With Quote
Old 10-17-2018, 01:05 PM   #13
rothchild
Human being with feelings
 
Join Date: Oct 2007
Posts: 784
Default

Fabian,

Thank you, that's incredibly generous (and for your super tidy checksum calc, I knew it could be done with brackets, but lack confidence in my maths)

I will take this as a place to start experimenting on the next level.

My other concern is how to adjust the param variable according to which slider is used (as I want control more than one parameter on the target box)do you have any suggestions?
rothchild is offline   Reply With Quote
Old 10-19-2018, 09:31 AM   #14
rothchild
Human being with feelings
 
Join Date: Oct 2007
Posts: 784
Default

Works great, no midi errors no jumping about in checksum values. It's going to take me a while to work out what's going on here but thanks again Fabian.

Now I need to work out how to change 'param' according to which slider is touched, going to need to get some conditionals worked out I guess to make that variable multiple things.
rothchild is offline   Reply With Quote
Old 10-19-2018, 11:38 AM   #15
Fabian
Human being with feelings
 
Fabian's Avatar
 
Join Date: Sep 2008
Location: Sweden
Posts: 7,431
Default

Quote:
Originally Posted by rothchild View Post
Works great, no midi errors no jumping about in checksum values. It's going to take me a while to work out what's going on here but thanks again Fabian.
You're welcome. I'm glad it works.

Quote:
Originally Posted by rothchild View Post
Now I need to work out how to change 'param' according to which slider is touched, going to need to get some conditionals worked out I guess to make that variable multiple things.
I am not sure what you are thinking about here... Do you want multiple sliders to affect the same variable? Or do you want multiple sliders, each affecting its own variable?

The latter is rather straightforward. Just code similar thing to what is already there concerning slider1 and the value of buf[9]. @slider gets called whenever any slider is moved, so just check the sliders against their respective variables one after the other and manipulate the one that was changed.
__________________
// MVHMF
I never always did the right thing, but all I did wasn't wrong...
Fabian is offline   Reply With Quote
Old 10-19-2018, 02:50 PM   #16
rothchild
Human being with feelings
 
Join Date: Oct 2007
Posts: 784
Default

Quote:
Originally Posted by Fabian View Post
The latter is rather straightforward. Just code similar thing to what is already there concerning slider1 and the value of buf[9]. @slider gets called whenever any slider is moved, so just check the sliders against their respective variables one after the other and manipulate the one that was changed.
Yup, it's this that I'm after.

Slider 1 is param = 0x0E
Slider 2 is param = 0x0F
etc

I'm sure it's straightforward when you know how, but bear in mind that I'd never actually written a single line of code before I started this project a couple of weeks ago! I'm away from the studio this weekend but will get back on to this on my return.

Have a great weekend!
rothchild is offline   Reply With Quote
Old 10-20-2018, 12:18 PM   #17
Fabian
Human being with feelings
 
Fabian's Avatar
 
Join Date: Sep 2008
Location: Sweden
Posts: 7,431
Default

Quote:
Originally Posted by rothchild View Post
Yup, it's this that I'm after.

Slider 1 is param = 0x0E
Slider 2 is param = 0x0F
etc

I'm sure it's straightforward when you know how, but bear in mind that I'd never actually written a single line of code before I started this project a couple of weeks ago! I'm away from the studio this weekend but will get back on to this on my return.

Have a great weekend!
I am again not sure if I understand what it is you are after, but does this look like it (and of course this is again not tested code)?

Code:
slider1:0<0,1,1> Set param to 0x0E
slider2:0<0,1,1> Set param to 0x0F

@slider
slider1 == 1 && prev1 == 0 ? ( param = 0x0E; );
slider2 == 1 && prev2 == 0 ? ( param = 0x0F; );
prev1 = slider1;
prev2 = slider2;
This doesn't make much sense to me, so probably I'm not interpreting you correctly. I would expect one slider to control the value of a distinct variable, not multiple sliders controlling the same variable.
__________________
// MVHMF
I never always did the right thing, but all I did wasn't wrong...
Fabian is offline   Reply With Quote
Old 10-21-2018, 01:45 PM   #18
rothchild
Human being with feelings
 
Join Date: Oct 2007
Posts: 784
Default

Thanks again Fabian,

I'm afraid it didn't work (the parameter byte stayed stuck on 0x0F)

I've tried to do my own version (which doesn't work either!) but I'm posting it anyway in the hope that it better explains what I'm trying to achieve.

Code:
desc:Roland SRV3030 EZ Edit Midi Control Experiment

//this is the proof of concept version 

in_pin:none
out_pin:none

slider1:50<0,100,1>Rev Time A 
//param = 0x0E
slider2:0<0,99,1> Rev Time A Suborder
//param = 0x0F
slider3:32<0,100,1>Liveliness A
//param = 0x10
slider4:32<0,100,1>Room Size A
//param = 0x11
slider5:32<0,100,1>Wall Type A
//param = 0x12
slider6:32<0,100,1>Distance A
//param = 0x13
slider7:32<0,100,1>Effect
//param = 0x14
slider8:100<0,100,1>Rev Unit Output Level A
//param = 0x15
slider9:50<0,100,1>Mix Balance
//param = 0x16
slider10:32<0,100,1>Rev Time B 
//param = 0x18
slider11:00<0,99,1>Rev Time B Suborder
//param = 0x19
slider12:32<0,100,1>Liveliness B
//param = 0x1A
slider13:32<0,100,1>Room Size B
//param = 0x1B
slider13:32<0,100,1>Wall Type B
//param = 0x1C
slider14:32<0,100,1>Distance B
//param = 0x1D
slider15:100<0,100,1>Rev Unit Output Level B
//param = 0x1F

@init
ext_noinit = 1; 

manuid = 0x41; //manufacturer ID
devid = 0x00; //device ID
modidmsb = 0x00; //model ID MSB
modidlsb = 0x12; //model ID LSB
comid = 0x12; //command ID
addmsb = 0x50; //address MSB
addbb = 0x00; //address bb
addcc = 0x00; //address cc
//param = 0x0E; //address LSB - this is the parameter (within ez edit) to be edited - taken out as defined with slider

// This only needs to be done once (by the looks of it)
buf = 100000; //sets start point and size of memory address
buf[0] = manuid; //manufacturer ID
buf[1] = devid; //device ID
buf[2] = modidmsb; //model ID MSB
buf[3] = modidlsb; //model ID LSB
buf[4] = comid; //command ID
buf[5] = addmsb; //address MSB
buf[6] = addbb; //address bb
buf[7] = addcc; //address cc
buf[8] = param; //address LSB

sendmidi = 0; // Used to tell @block when to send out midi

//checksum calculator (add items together, divide by 128 and subtract remainder from 128)
function calc_checksum(value)
(
	0x80 - ((addmsb + addbb + addcc + param + value) % 0x80);      
);

@slider

slider1 == 1 && param = 0x0E ? ( value = slider1; ); //IF slider1 is moved THEN param = 0x0E AND value = slider1
slider2 == 1 && param = 0x0F ? ( value = slider2; );
slider3 == 1 && param = 0x10 ? ( value = slider3; );
//prev1 = slider1;
//prev2 = slider2;

value = slider1 | slider2 | slider3;
value != buf[9] ? // buf[9] holds the old value
(
	buf[9] = value;
	buf[10] = calc_checksum(value);
	sendmidi = 1;
);

@block
sendmidi ? 
(
	midisend_buf(0,buf,11); //sends the command
	sendmidi = 0; 
);
rothchild is offline   Reply With Quote
Old 10-23-2018, 01:18 PM   #19
Fabian
Human being with feelings
 
Fabian's Avatar
 
Join Date: Sep 2008
Location: Sweden
Posts: 7,431
Default

Quote:
Originally Posted by rothchild View Post
Thanks again Fabian,

I'm afraid it didn't work (the parameter byte stayed stuck on 0x0F)

I've tried to do my own version (which doesn't work either!) but I'm posting it anyway in the hope that it better explains what I'm trying to achieve.

Code:
desc:Roland SRV3030 EZ Edit Midi Control Experiment

//this is the proof of concept version 

in_pin:none
out_pin:none

slider1:50<0,100,1>Rev Time A 
//param = 0x0E
slider2:0<0,99,1> Rev Time A Suborder
//param = 0x0F
slider3:32<0,100,1>Liveliness A
//param = 0x10
slider4:32<0,100,1>Room Size A
//param = 0x11
slider5:32<0,100,1>Wall Type A
//param = 0x12
slider6:32<0,100,1>Distance A
//param = 0x13
slider7:32<0,100,1>Effect
//param = 0x14
slider8:100<0,100,1>Rev Unit Output Level A
//param = 0x15
slider9:50<0,100,1>Mix Balance
//param = 0x16
slider10:32<0,100,1>Rev Time B 
//param = 0x18
slider11:00<0,99,1>Rev Time B Suborder
//param = 0x19
slider12:32<0,100,1>Liveliness B
//param = 0x1A
slider13:32<0,100,1>Room Size B
//param = 0x1B
slider13:32<0,100,1>Wall Type B
//param = 0x1C
slider14:32<0,100,1>Distance B
//param = 0x1D
slider15:100<0,100,1>Rev Unit Output Level B
//param = 0x1F

@init
ext_noinit = 1; 

manuid = 0x41; //manufacturer ID
devid = 0x00; //device ID
modidmsb = 0x00; //model ID MSB
modidlsb = 0x12; //model ID LSB
comid = 0x12; //command ID
addmsb = 0x50; //address MSB
addbb = 0x00; //address bb
addcc = 0x00; //address cc
//param = 0x0E; //address LSB - this is the parameter (within ez edit) to be edited - taken out as defined with slider

// This only needs to be done once (by the looks of it)
buf = 100000; //sets start point and size of memory address
buf[0] = manuid; //manufacturer ID
buf[1] = devid; //device ID
buf[2] = modidmsb; //model ID MSB
buf[3] = modidlsb; //model ID LSB
buf[4] = comid; //command ID
buf[5] = addmsb; //address MSB
buf[6] = addbb; //address bb
buf[7] = addcc; //address cc
buf[8] = param; //address LSB

sendmidi = 0; // Used to tell @block when to send out midi

//checksum calculator (add items together, divide by 128 and subtract remainder from 128)
function calc_checksum(value)
(
	0x80 - ((addmsb + addbb + addcc + param + value) % 0x80);      
);

@slider

slider1 == 1 && param = 0x0E ? ( value = slider1; ); //IF slider1 is moved THEN param = 0x0E AND value = slider1
slider2 == 1 && param = 0x0F ? ( value = slider2; );
slider3 == 1 && param = 0x10 ? ( value = slider3; );
//prev1 = slider1;
//prev2 = slider2;

value = slider1 | slider2 | slider3;
value != buf[9] ? // buf[9] holds the old value
(
	buf[9] = value;
	buf[10] = calc_checksum(value);
	sendmidi = 1;
);

@block
sendmidi ? 
(
	midisend_buf(0,buf,11); //sends the command
	sendmidi = 0; 
);
No, whatever it is you want to do, this wont work...

Can you describe in detail what it is you really want to do? The "param" is it really a single variable that you want all of the sliders to change? I do not get why you would want to do that. Typically one slider affects one variable...

Or... maybe I get it now. The param variable tells the receiver of the MIDI package which of the different parameters it is that is supposed to be changed, is that it? Say, you move slider3 and set Liveliness A to 50, then the "value" variable should be 50, and the "param" variable should be 0x10, and this you is then sent out with the checksum and all.

Then I guess you would need to do something like this:
Code:
slider1:50<0,100,1>Rev Time A 
//param = 0x0E
slider2:0<0,99,1> Rev Time A Suborder
//param = 0x0F
slider3:32<0,100,1>Liveliness A
//param = 0x10

// The stuff we already know is cut out here...

@slider
slider1 != old_slider1 ? ( value = slider1; old_slider1 = slider1; param = 0x0E; sliderchanged = 1; );
slider2 != old_slider2 ? ( value = slider2; old_slider2 = slider2; param = 0x0F; sliderchanged = 1; );
slider3 != old_slider3 ? ( value = slider3; old_slider3 = slider3; param = 0x10; sliderchanged = 1; );

// And similar for the rest of the sliders

sliderchanged ? // Then we are to send MIDI, set up the buffer and indicate send
(
	buf[8] = param;
	buf[9] = value;
	buf[10] = calc_checksum(value);
	sendmidi = 1;
	sliderchanged = 0:
);

@block
sendmidi ? 
(
	midisend_buf(0,buf,11); //sends the command
	sendmidi = 0; 
);
I think you have to initialize the old_slider1, old_slider2 etc variables to the default values of the sliders for not to have a burst of MIDI packages sent out initially. For instance, old_slider1 should initially be set to 50, old_slider2 to 0, old_slider3 to 32, etc.

I think the checksum now also needs to take the "param" variable as a parameter, noty only the "value". Or you simply use buf[8] and buf[9] in the checksum calculation and don't pass any parameters.
__________________
// MVHMF
I never always did the right thing, but all I did wasn't wrong...
Fabian is offline   Reply With Quote
Old 10-23-2018, 02:32 PM   #20
rothchild
Human being with feelings
 
Join Date: Oct 2007
Posts: 784
Default

Quote:
Originally Posted by Fabian View Post

Or... maybe I get it now. The param variable tells the receiver of the MIDI package which of the different parameters it is that is supposed to be changed, is that it? Say, you move slider3 and set Liveliness A to 50, then the "value" variable should be 50, and the "param" variable should be 0x10, and this you is then sent out with the checksum and all.
Yes, it's this. I have to work late tomorrow so probably won't get to test the new solution until Thursday now.

Your help (and patience!) has been amazing. Do you have a paypal or something that I can buy you a couple of drinks with? Or, if you'd like me to make a donation to charity on your behalf please name it and I will, gladly.
rothchild is offline   Reply With Quote
Old 10-24-2018, 01:37 AM   #21
Fabian
Human being with feelings
 
Fabian's Avatar
 
Join Date: Sep 2008
Location: Sweden
Posts: 7,431
Default

Quote:
Originally Posted by rothchild View Post
Yes, it's this. I have to work late tomorrow so probably won't get to test the new solution until Thursday now.

Your help (and patience!) has been amazing. Do you have a paypal or something that I can buy you a couple of drinks with? Or, if you'd like me to make a donation to charity on your behalf please name it and I will, gladly.
You are welcome. If you want to donate to charity, please do, but I do this just to help. I hope you get it solved, I think my latest suggestion can actually be (a part of) the solution.
__________________
// MVHMF
I never always did the right thing, but all I did wasn't wrong...
Fabian is offline   Reply With Quote
Old 10-25-2018, 10:51 AM   #22
rothchild
Human being with feelings
 
Join Date: Oct 2007
Posts: 784
Default

Just got to testing it and it works great, I've made a donation to the WWF (World Wildlife Fund for Nature, not the wrestling folk ;-)) on you behalf.

Completed version:

Code:
desc:Roland SRV3030 EZ Edit Midi Controller 

//Original ideal by Rothchild with the important and difficult stuff by Fabian on the Reaper Forum
//This is a controller for the Roland SRV3030/D reverb unit. This version controls the basic parameters in EZ Edit mode.

in_pin:none
out_pin:none

slider1:50<0,100,1>Rev Time A 
slider2:0<0,99,1> Rev Time A Suborder
slider3:32<0,100,1>Liveliness A
slider4:32<0,100,1>Room Size A
slider5:32<0,100,1>Wall Type A
slider6:32<0,100,1>Distance A
slider7:32<0,100,1>Effect
slider8:100<0,100,1>Rev Unit Output Level A
slider9:50<0,100,1>Mix Balance
slider10:32<0,100,1>Rev Time B 
slider11:00<0,99,1>Rev Time B Suborder
slider12:32<0,100,1>Liveliness B
slider13:32<0,100,1>Room Size B
slider14:32<0,100,1>Wall Type B
slider15:32<0,100,1>Distance B
slider16:100<0,100,1>Rev Unit Output Level B

@init
ext_noinit = 1; 

//Define fixed variables
manuid = 0x41; //manufacturer ID
devid = 0x00; //device ID
modidmsb = 0x00; //model ID MSB
modidlsb = 0x12; //model ID LSB
comid = 0x12; //command ID
addmsb = 0x50; //address MSB
addbb = 0x00; //address bb
addcc = 0x00; //address cc

//add fixed variables to buffer
buf = 100000; //sets start point and size of memory address
buf[0] = manuid; //manufacturer ID
buf[1] = devid; //device ID
buf[2] = modidmsb; //model ID MSB
buf[3] = modidlsb; //model ID LSB
buf[4] = comid; //command ID
buf[5] = addmsb; //address MSB
buf[6] = addbb; //address bb
buf[7] = addcc; //address cc
buf[8] = param; //address LSB

sendmidi = 0; // Used to tell @block when to send out midi

//Roland checksum calculator (add items together, divide by 128 and subtract remainder from 128)
function calc_checksum(value)
(
	0x80 - ((addmsb + addbb + addcc + param + value) % 0x80);      
);

@slider
//Detect which slider is in use and adjust parameter and value to control + feed in to checksum
slider1 != old_slider1 ? ( value = slider1; old_slider1 = slider1; param = 0x0E; sliderchanged = 1; );
slider2 != old_slider2 ? ( value = slider2; old_slider2 = slider2; param = 0x0F; sliderchanged = 1; );
slider3 != old_slider3 ? ( value = slider3; old_slider3 = slider3; param = 0x10; sliderchanged = 1; );
slider4 != old_slider4 ? ( value = slider4; old_slider4 = slider4; param = 0x11; sliderchanged = 1; );
slider5 != old_slider5 ? ( value = slider5; old_slider5 = slider5; param = 0x12; sliderchanged = 1; );
slider6 != old_slider6 ? ( value = slider6; old_slider6 = slider6; param = 0x13; sliderchanged = 1; );
slider7 != old_slider7 ? ( value = slider7; old_slider7 = slider7; param = 0x14; sliderchanged = 1; );
slider8 != old_slider8 ? ( value = slider8; old_slider8 = slider8; param = 0x15; sliderchanged = 1; );
slider9 != old_slider9 ? ( value = slider9; old_slider9 = slider9; param = 0x16; sliderchanged = 1; );
slider10 != old_slider10 ? ( value = slider10; old_slider10 = slider10; param = 0x18; sliderchanged = 1; );
slider11 != old_slider11 ? ( value = slider11; old_slider11 = slider11; param = 0x19; sliderchanged = 1; );
slider12 != old_slider12 ? ( value = slider12; old_slider12 = slider12; param = 0x1A; sliderchanged = 1; );
slider13 != old_slider13 ? ( value = slider13; old_slider13 = slider13; param = 0x1B; sliderchanged = 1; );
slider14 != old_slider14 ? ( value = slider14; old_slider14 = slider14; param = 0x1C; sliderchanged = 1; );
slider15 != old_slider15 ? ( value = slider15; old_slider15 = slider15; param = 0x1D; sliderchanged = 1; );
slider16 != old_slider16 ? ( value = slider16; old_slider16 = slider16; param = 0x1F; sliderchanged = 1; );

sliderchanged ? // Then we are to send MIDI, set up the buffer and indicate send
(
	buf[8] = param;
	buf[9] = value;
	buf[10] = calc_checksum(value);
	sendmidi = 1;
	sliderchanged = 0;
);

@block
sendmidi ? 
(
	midisend_buf(0,buf,11); //sends the command
	sendmidi = 0; 
);
That's 'EZ Edit' mode covered, now I'm going to extrapolate it to the more detailed set of parameters that are available to be addressed.

Next level would be to call a sysex dump of the patch, so the parameters match the selected patch and even that there be 2-way communication between the device and the plugin.
rothchild is offline   Reply With Quote
Old 10-27-2018, 08:25 AM   #23
rothchild
Human being with feelings
 
Join Date: Oct 2007
Posts: 784
Default

Cracking on now :-)

Here's the editor for the structure page:

Code:
desc:Roland SRV3030 Structure Edit Midi Controller

//Original ideal by Rothchild with the important and difficult stuff by Fabian on the Reaper Forum
//This is a controller for the Roland SRV3030/D reverb unit. This version controls the basic parameters in EZ Edit mode.

in_pin:none
out_pin:none

slider1:0<0,3,1{Reverb,Gated Reverb,Ambience,Non-Linear}>Rev Type A 
slider2:0<0,3,1{Reverb,Gated Reverb,Ambience,Non-Linear}>Rev Type B
slider3:3<0,3,1{Dual,Series,Individual,Stereo}>Structure
slider4:50<0,100,1>Mix Balance
slider5:0<0,3,1{Off,Unit A,Unit B,Master}>Effect Routing
slider6:0<0,3,1{Off,Unit A,Unit B,Master}>RSS Routing
slider7:0<0,4,1{Off,Attack,Loudness,Note,Drum}>Dynamic Separator Type 
slider8:0<0,1,1{Unit A,Unit B}>Dynamic Separator Destination
slider9:50<0,100,1>Dynamic Separator Rate
slider10:0<0,10,1>Dynamic Separator Frequency
slider11:00<0,100,1>Dynamic Separator Sensitivity
slider12:00<0,100,1>Dynamic Separator Sensitivity Low
slider13:17<0,17,1{1.6kHz,1.8kHz,2.0kHz,2.2kHz,2.5kHz,2.8kHz,3.2kHz,3.6kHz,4.0kHz,4.5kHz,5.0kHz,5.6kHz,6.3kHz,7.1kHz,8.0kHz,9.0kHz,10kHz,11kHz,13kHz,14kHz,16kHz,18kHz,20kHz,Off}>Pre-Low-Pass Unit A
slider14:17<0,17,1{1.6kHz,1.8kHz,2.0kHz,2.2kHz,2.5kHz,2.8kHz,3.2kHz,3.6kHz,4.0kHz,4.5kHz,5.0kHz,5.6kHz,6.3kHz,7.1kHz,8.0kHz,9.0kHz,10kHz,11kHz,13kHz,14kHz,16kHz,18kHz,20kHz,Off}>Pre-Low-Pass Unit B
slider15:0<0,29,1{Off,20Hz,22Hz,25Hz,28Hz,32Hz,36Hz,40Hz,45Hz,50Hz,56Hz,63Hz,71Hz,80Hz,90Hz,100Hz,112Hz,125Hz,140Hz,160Hz,189Hz,200Hz,224Hz,250Hz,280Hz,315Hz,355Hz,400Hz,450Hz,500Hz,560Hz,630Hz,710Hz,800Hz,900Hz,1.0kHz,1.1kHz,1.3kHz,1.6kHz,1.8kHz,2.0kHz}>Pre-Hi-Pass Unit A
slider16:0<0,29,1{Off,20Hz,22Hz,25Hz,28Hz,32Hz,36Hz,40Hz,45Hz,50Hz,56Hz,63Hz,71Hz,80Hz,90Hz,100Hz,112Hz,125Hz,140Hz,160Hz,189Hz,200Hz,224Hz,250Hz,280Hz,315Hz,355Hz,400Hz,450Hz,500Hz,560Hz,630Hz,710Hz,800Hz,900Hz,1.0kHz,1.1kHz,1.3kHz,1.6kHz,1.8kHz,2.0kHz}>Pre-Hi-Pass Unit B
slider17:100<0,100,1>Unit A Input Level
slider18:100<0,100,1>Unit B Input Level
slider19:100<0,100,1>Unit A Output Level
slider20:100<0,100,1>Unit B Output Level

@init
ext_noinit = 1; 

//Define fixed variables
manuid = 0x41; //manufacturer ID
devid = 0x00; //device ID
modidmsb = 0x00; //model ID MSB
modidlsb = 0x12; //model ID LSB
comid = 0x12; //command ID
addmsb = 0x50; //address MSB
addbb = 0x00; //address bb
addcc = 0x00; //address cc

//add fixed variables to buffer
buf = 100000; //sets start point and size of memory address
buf[0] = manuid; //manufacturer ID
buf[1] = devid; //device ID
buf[2] = modidmsb; //model ID MSB
buf[3] = modidlsb; //model ID LSB
buf[4] = comid; //command ID
buf[5] = addmsb; //address MSB
buf[6] = addbb; //address bb
buf[7] = addcc; //address cc
buf[8] = param; //address LSB

sendmidi = 0; // Used to tell @block when to send out midi

//Roland checksum calculator (add items together, divide by 128 and subtract remainder from 128)
function calc_checksum(value)
(
	0x80 - ((addmsb + addbb + addcc + param + value) % 0x80);      
);

@slider
//Detect which slider is in use and adjust parameter and value to control + feed in to checksum
slider1 != old_slider1 ? ( value = slider1; old_slider1 = slider1; param = 0x22; sliderchanged = 1; );
slider2 != old_slider2 ? ( value = slider2; old_slider2 = slider2; param = 0x23; sliderchanged = 1; );
slider3 != old_slider3 ? ( value = slider3; old_slider3 = slider3; param = 0x24; sliderchanged = 1; );
slider4 != old_slider4 ? ( value = slider4; old_slider4 = slider4; param = 0x25; sliderchanged = 1; );
slider5 != old_slider5 ? ( value = slider5; old_slider5 = slider5; param = 0x26; sliderchanged = 1; );
slider6 != old_slider6 ? ( value = slider6; old_slider6 = slider6; param = 0x27; sliderchanged = 1; );
slider7 != old_slider7 ? ( value = slider7; old_slider7 = slider7; param = 0x28; sliderchanged = 1; );
slider8 != old_slider8 ? ( value = slider8; old_slider8 = slider8; param = 0x29; sliderchanged = 1; );
slider9 != old_slider9 ? ( value = slider9; old_slider9 = slider9; param = 0x2A; sliderchanged = 1; );
slider10 != old_slider10 ? ( value = slider10; old_slider10 = slider10; param = 0x2B; sliderchanged = 1; );
slider11 != old_slider11 ? ( value = slider11; old_slider11 = slider11; param = 0x2C; sliderchanged = 1; );
slider12 != old_slider12 ? ( value = slider12; old_slider12 = slider12; param = 0x2D; sliderchanged = 1; );
slider13 != old_slider13 ? ( value = slider13; old_slider13 = slider13; param = 0x2E; sliderchanged = 1; );
slider14 != old_slider14 ? ( value = slider14; old_slider14 = slider14; param = 0x2F; sliderchanged = 1; );
slider15 != old_slider15 ? ( value = slider15; old_slider15 = slider15; param = 0x30; sliderchanged = 1; );
slider16 != old_slider16 ? ( value = slider16; old_slider16 = slider16; param = 0x31; sliderchanged = 1; );
slider17 != old_slider17 ? ( value = slider17; old_slider17 = slider17; param = 0x32; sliderchanged = 1; );
slider18 != old_slider18 ? ( value = slider18; old_slider18 = slider18; param = 0x33; sliderchanged = 1; );
slider19 != old_slider19 ? ( value = slider19; old_slider19 = slider19; param = 0x34; sliderchanged = 1; );
slider20 != old_slider20 ? ( value = slider20; old_slider20 = slider20; param = 0x35; sliderchanged = 1; );
sliderchanged ? // Then we are to send MIDI, set up the buffer and indicate send
(
	buf[8] = param;
	buf[9] = value;
	buf[10] = calc_checksum(value);
	sendmidi = 1;
	sliderchanged = 0;
);

@block
sendmidi ? 
(
	midisend_buf(0,buf,11); //sends the command
	sendmidi = 0; 
);

Last edited by rothchild; 10-27-2018 at 08:35 AM.
rothchild is offline   Reply With Quote
Old 10-28-2018, 09:12 AM   #24
Fabian
Human being with feelings
 
Fabian's Avatar
 
Join Date: Sep 2008
Location: Sweden
Posts: 7,431
Default

Quote:
Originally Posted by rothchild View Post
Just got to testing it and it works great, I've made a donation to the WWF (World Wildlife Fund for Nature, not the wrestling folk ;-)) on you behalf.
Great that you got it working!
And nice touch with the donation. Thanks.

Have fun
__________________
// MVHMF
I never always did the right thing, but all I did wasn't wrong...
Fabian is offline   Reply With Quote
Old 10-28-2018, 03:13 PM   #25
rothchild
Human being with feelings
 
Join Date: Oct 2007
Posts: 784
Default

Thanks again Fabian.

I've got the whole lot coded now, so I can reach every parameter in the box, but I'm scratching my head over one little line.

In this module slider1 needs to start with a value of 01 (rather than 00) but regardless of the values I put in I can't get to 'Amb8' (and I can see in reacontrol midi that the first value is always 00 (when I want it to be 01) - it seems to be a quirk as all the other parameters in the box follow the normal convention of starting on 00!

Code:
desc:Amb-A1 Midi Controller for Roland SRV3030 

//Original ideal by Rothchild with the important and difficult stuff by Fabian on the Reaper Forum
//This is a controller for the Roland SRV3030/D reverb unit. This version controls the Unit A parameters when an Ambience type is selected in the structure.

in_pin:none
out_pin:none

slider1:1<1,8,1{Amb1,Amb2,Amb3,Amb4,Amb5,Amb6,Amb7,Amb8}> Ambience Variation
slider2:0<0,100,1>Ambience Level 
slider3:0<0,100,1>Ambience Level: Dynamic Control
slider4:0<0,1,1{Nomal,Inverted}>Ambience Level: Dynamic Polarity
slider5:0<0,100,1>Ambience Room Size
slider6:100<0,100,1>HF Damping Gain (-36dB to 0dB)
slider7:0<0,100,1>Density
slider8:0<0,20,1>Tap 1 Time
slider9:0<0,99,1>Tap 1 Time Suborder
slider10:0<0,100,1>Tap 1 Level
slider11:51<0,101,1>Tap 1 Pan
slider12:0<0,26,1{200Hz,250Hz,300Hz,350Hz,400Hz,500Hz,600Hz,700Hz,800Hz,900Hz,1.0kHz,1.2kHz,1.5kHz,2.0kHz,2.5kHz,3.0kHz,3.5kHz,4.0kHz,5.0kHz,6.0kHz,7.0kHz,8.0kHz,9.0kHz,10kHz,12kHz,15kHz,20kHz}>Tap 1 High Cut Freq
slider13:100<0,100,1>Tap 1 HF Damping Gain (-36dB to 0dB)
slider14:0<0,20,1>Tap 2 Time
slider15:0<0,99,1>Tap 2 Time Suborder
slider16:0<0,100,1>Tap 2 Level
slider17:51<0,101,1>Tap 2 Pan
slider18:0<0,26,1{200Hz,250Hz,300Hz,350Hz,400Hz,500Hz,600Hz,700Hz,800Hz,900Hz,1.0kHz,1.2kHz,1.5kHz,2.0kHz,2.5kHz,3.0kHz,3.5kHz,4.0kHz,5.0kHz,6.0kHz,7.0kHz,8.0kHz,9.0kHz,10kHz,12kHz,15kHz,20kHz}>Tap 2 High Cut Freq
slider19:100<0,100,1>Tap 2 HF Damping Gain (-36dB to 0dB)
slider20:0<0,20,1>Tap 3 Time
slider21:0<0,99,1>Tap 3 Time Suborder
slider22:0<0,100,1>Tap 3 Level
slider23:51<0,101,1>Tap 3 Pan
slider24:0<0,26,1{200Hz,250Hz,300Hz,350Hz,400Hz,500Hz,600Hz,700Hz,800Hz,900Hz,1.0kHz,1.2kHz,1.5kHz,2.0kHz,2.5kHz,3.0kHz,3.5kHz,4.0kHz,5.0kHz,6.0kHz,7.0kHz,8.0kHz,9.0kHz,10kHz,12kHz,15kHz,20kHz}>Tap 3 High Cut Freq
slider25:100<0,100,1>Tap 3 HF Damping Gain (-36dB to 0dB)
slider26:0<0,20,1>Tap 4 Time
slider27:0<0,99,1>Tap 4 Time Suborder
slider28:0<0,100,1>Tap 4 Level
slider29:51<0,101,1>Tap 4 Pan
slider30:0<0,26,1{200Hz,250Hz,300Hz,350Hz,400Hz,500Hz,600Hz,700Hz,800Hz,900Hz,1.0kHz,1.2kHz,1.5kHz,2.0kHz,2.5kHz,3.0kHz,3.5kHz,4.0kHz,5.0kHz,6.0kHz,7.0kHz,8.0kHz,9.0kHz,10kHz,12kHz,15kHz,20kHz}>Tap 4 High Cut Freq
slider31:100<0,100,1>Tap 4 HF Damping Gain (-36dB to 0dB)
slider32:0<0,20,1>Tap 5 Time
slider33:0<0,99,1>Tap 5 Time Suborder
slider34:0<0,100,1>Tap 5 Level
slider35:51<0,101,1>Tap 5 Pan
slider36:0<0,26,1{200Hz,250Hz,300Hz,350Hz,400Hz,500Hz,600Hz,700Hz,800Hz,900Hz,1.0kHz,1.2kHz,1.5kHz,2.0kHz,2.5kHz,3.0kHz,3.5kHz,4.0kHz,5.0kHz,6.0kHz,7.0kHz,8.0kHz,9.0kHz,10kHz,12kHz,15kHz,20kHz}>Tap 5 High Cut Freq
slider37:100<0,100,1>Tap 5 HF Damping Gain (-36dB to 0dB)

@init
ext_noinit = 1; 

//Define fixed variables
manuid = 0x41; //manufacturer ID
devid = 0x00; //device ID
modidmsb = 0x00; //model ID MSB
modidlsb = 0x12; //model ID LSB
comid = 0x12; //command ID
addmsb = 0x50; //address MSB
addbb = 0x00; //address bb
addcc = 0x00; //address cc

//add fixed variables to buffer
buf = 100000; //sets start point and size of memory address
buf[0] = manuid; //manufacturer ID
buf[1] = devid; //device ID
buf[2] = modidmsb; //model ID MSB
buf[3] = modidlsb; //model ID LSB
buf[4] = comid; //command ID
buf[5] = addmsb; //address MSB
buf[6] = addbb; //address bb
buf[7] = addcc; //address cc
buf[8] = param; //address LSB

sendmidi = 0; // Used to tell @block when to send out midi

//Roland checksum calculator (add items together, divide by 128 and subtract remainder from 128)
function calc_checksum(value)
(
	0x80 - ((addmsb + addbb + addcc + param + value) % 0x80);      
);

@slider
//Detect which slider is in use and adjust parameter and value to control + feed in to checksum
slider1 != old_slider1 ? ( value = slider1; old_slider1 = slider1; param = 0x38; sliderchanged = 1; );
slider2 != old_slider2 ? ( value = slider2; old_slider2 = slider2; param = 0x39; sliderchanged = 1; );
slider3 != old_slider3 ? ( value = slider3; old_slider3 = slider3; param = 0x3A; sliderchanged = 1; );
slider4 != old_slider4 ? ( value = slider4; old_slider4 = slider4; param = 0x3B; sliderchanged = 1; );
slider5 != old_slider5 ? ( value = slider5; old_slider5 = slider5; param = 0x3C; sliderchanged = 1; );
slider6 != old_slider6 ? ( value = slider6; old_slider6 = slider6; param = 0x3D; sliderchanged = 1; );
slider7 != old_slider7 ? ( value = slider7; old_slider7 = slider7; param = 0x3E; sliderchanged = 1; );
slider8 != old_slider8 ? ( value = slider8; old_slider8 = slider8; param = 0x3F; sliderchanged = 1; );
slider9 != old_slider9 ? ( value = slider9; old_slider9 = slider9; param = 0x40; sliderchanged = 1; );
slider10 != old_slider10 ? ( value = slider10; old_slider10 = slider10; param = 0x41; sliderchanged = 1; );
slider11 != old_slider11 ? ( value = slider11; old_slider11 = slider11; param = 0x42; sliderchanged = 1; );
slider12 != old_slider12 ? ( value = slider12; old_slider12 = slider12; param = 0x43; sliderchanged = 1; );
slider13 != old_slider13 ? ( value = slider13; old_slider13 = slider13; param = 0x44; sliderchanged = 1; );
slider14 != old_slider14 ? ( value = slider14; old_slider14 = slider14; param = 0x45; sliderchanged = 1; );
slider15 != old_slider15 ? ( value = slider15; old_slider15 = slider15; param = 0x46; sliderchanged = 1; );
slider16 != old_slider16 ? ( value = slider16; old_slider16 = slider16; param = 0x47; sliderchanged = 1; );
slider17 != old_slider17 ? ( value = slider17; old_slider17 = slider17; param = 0x48; sliderchanged = 1; );
slider18 != old_slider18 ? ( value = slider18; old_slider18 = slider18; param = 0x49; sliderchanged = 1; );
slider19 != old_slider19 ? ( value = slider19; old_slider19 = slider19; param = 0x4A; sliderchanged = 1; );
slider20 != old_slider20 ? ( value = slider20; old_slider20 = slider20; param = 0x4B; sliderchanged = 1; );
slider21 != old_slider21 ? ( value = slider21; old_slider21 = slider21; param = 0x4C; sliderchanged = 1; );
slider22 != old_slider22 ? ( value = slider22; old_slider22 = slider22; param = 0x4D; sliderchanged = 1; );
slider23 != old_slider23 ? ( value = slider23; old_slider23 = slider23; param = 0x4E; sliderchanged = 1; );
slider24 != old_slider24 ? ( value = slider24; old_slider24 = slider24; param = 0x4F; sliderchanged = 1; );
slider25 != old_slider25 ? ( value = slider25; old_slider25 = slider25; param = 0x50; sliderchanged = 1; );
slider26 != old_slider26 ? ( value = slider26; old_slider26 = slider26; param = 0x51; sliderchanged = 1; );
slider27 != old_slider27 ? ( value = slider27; old_slider27 = slider27; param = 0x52; sliderchanged = 1; );
slider28 != old_slider28 ? ( value = slider28; old_slider28 = slider28; param = 0x53; sliderchanged = 1; );
slider29 != old_slider29 ? ( value = slider29; old_slider29 = slider29; param = 0x54; sliderchanged = 1; );
slider30 != old_slider30 ? ( value = slider30; old_slider30 = slider30; param = 0x55; sliderchanged = 1; );
slider31 != old_slider31 ? ( value = slider31; old_slider31 = slider31; param = 0x56; sliderchanged = 1; );
slider32 != old_slider32 ? ( value = slider32; old_slider32 = slider32; param = 0x57; sliderchanged = 1; );
slider33 != old_slider33 ? ( value = slider33; old_slider33 = slider33; param = 0x58; sliderchanged = 1; );
slider34 != old_slider34 ? ( value = slider34; old_slider34 = slider34; param = 0x59; sliderchanged = 1; );
slider35 != old_slider35 ? ( value = slider35; old_slider35 = slider35; param = 0x5A; sliderchanged = 1; );
slider36 != old_slider36 ? ( value = slider36; old_slider36 = slider36; param = 0x5B; sliderchanged = 1; );
slider37 != old_slider37 ? ( value = slider37; old_slider37 = slider37; param = 0x5C; sliderchanged = 1; );

sliderchanged ? // Then we are to send MIDI, set up the buffer and indicate send
(
	buf[8] = param;
	buf[9] = value;
	buf[10] = calc_checksum(value);
	sendmidi = 1;
	sliderchanged = 0;
);

@block
sendmidi ? 
(
	midisend_buf(0,buf,11); //sends the command
	sendmidi = 0; 
);
rothchild is offline   Reply With Quote
Old 10-29-2018, 04:58 AM   #26
Fabian
Human being with feelings
 
Fabian's Avatar
 
Join Date: Sep 2008
Location: Sweden
Posts: 7,431
Default

Code:
slider1:1<1,8,1{Amb1,Amb2,Amb3,Amb4,Amb5,Amb6,Amb7,Amb8}> Ambience Variation
I think the counting of the options always starts at 0, so if your device considers 1 to be "Amb1", 2 "Amb2" etc, and 8 to be "Amb8", maybe you simply add 1 to the value that you send out?

Like:
Code:
slider1:0<0,7,1{Amb1,Amb2,Amb3,Amb4,Amb5,Amb6,Amb7,Amb8}> Ambience Variation

...

slider1 != old_slider1 ? ( value = slider1 + 1; old_slider1 = slider1; param = 0x38; sliderchanged = 1; );
Maybe...
__________________
// MVHMF
I never always did the right thing, but all I did wasn't wrong...
Fabian is offline   Reply With Quote
Old 10-29-2018, 01:08 PM   #27
rothchild
Human being with feelings
 
Join Date: Oct 2007
Posts: 784
Default

That's done it, thanks.

2 days of pasting numbers in to columns any my brain's gone soft for solutions!

The full set are here now:

https://stash.reaper.fm/v/34722/SRV3...tor%20JSFX.zip
rothchild is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 01:58 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.