Converting system exclusive to control change

OK, I will propose you something this week-end.

Thanx you so much! I’m very sorry I can’t create any script myself, so I really appreciate your help!

Hi,

Give this Rackspace Script a try. Pay attention to the comments for setting up your ports (MidiIn and MidiOut Blocks) and desired CC number

// Provided by Steve Caldwell 
// 2024-12-05

Var
// Set Desired MIDI In and MIDI Out ports
// Make sure you enable SysEX on the MIDI In Block
   MyMidiIn : MidiInBlock
   MyMidiOut : MidiOutBlock
   i : String
   r : Int
   note: Int
   next: Int
   working : String
   myPattern : String = "F043107F1C02304053"
   pattern : String
   plen: Int
// Enter desired CC number here
   CC: Int = 5
   message: MidiMessage
On SysexEvent(s : SysexMessage) from MyMidiIn
	//  OpenLogWindow()
	note=0
	i = s
	r = Length(i)
//	Print("MyPattern=" + myPattern)
	pattern = CopySubstring(i,0,18)
//	Print("Pattern    =" + pattern)
	if myPattern == pattern then
//	    Print("Match")
			working = CopySubstring(i,18,2)
//			Print("Working=" + working)
			message = MakeMidiMessage3(0xb0,CC,StringToInt(working))
			// InjectMidiEvent("Local GP Port", message)
			SendNowExternal(MyMidiOut,message)
	End // if myPattern == pattern
End // SysexEvent

There are a few stray variables that I don’t use that were used in a previous script that I created.

Edit: I may need to test this further as I’m not Sure StringToInt() will handle Hexadecimal Characters. Probably use StringToHex() instead.

SteveC

This one is simpler and better:

// Provided by Steve Caldwell 
// 2024-12-05

Var
// Set Desired MIDI In and MIDI Out ports
// Make sure you enable SysEX on the MIDI In Block
   MyMidiIn : MidiInBlock
   MyMidiOut : MidiOutBlock
   myPattern : String = "F043107F1C02304053"
   pattern : String
   i: String
// Enter desired CC number here
   CC: Int = 5
   message: MidiMessage
On SysexEvent(s : SysexMessage) from MyMidiIn
// convert SysEX to string for comparison
i = s
pattern = CopySubstring(i,0,18)
	if myPattern == pattern then
			message = MakeMidiMessage3(0xb0,CC,SM_GetValue(s,9))
			// use the below instead of SendNowExternal() to inject GP Port
		    // InjectMidiEvent("Local GP Port", message)
			SendNowExternal(MyMidiOut,message)
	End // if myPattern == pattern
End // SysexEvent
1 Like

Thanx Steve! Really appreciate it!

Sorry for this dumb questions:

  • this script will be in the Gig GPscript (so I don’t need to copy it in every rackspace) right?
  • how do set the midi in and out ports? Do I need to use handles? or just the name from the block?
    So in the global rackspace I create an Midi in Block (Sysex only) and Midi Out Block = Local GP port?

Thanx for your help!

This particular script is written to work in rackspaces.

Use Handles with the given names or change both the names in the script and the handles as you like. If you use InjectMidiEvent() you won’t need a handle here.

You will need MidiIBlock in the currently used rackspace local or Global to align with where you put the script. Again you will not need MidiOutBluck for Injecting into the Local GP port.

I suppose with a few tweaks it could be written without blocks and put into a global GP Script, but I leave these modifications to you to figure out.

The thing with GP Script is some functions only work in RackSpaces, others only work in Scriptletts and others only work as Gig level Script. This is what I’m still learning to get my head around and keep tripping myself up depending where I want to put the script. Yes, I’m still very much learning this stuff.

SteveC

Thank you for your help.
Too bad I’m not capable to tweak your script because of the lack of scripting knowledge.
Hopefully @David-san can help me with this.

Thanx!

Of course, I promised I would. :wink:

But, as I told you, my solution is based on a Gig GPScript which works perfectly for this kind of conversion.

  1. So, first in Rig Manager, define a ā€œWorkstationā€ MIDI port alias name for your Montage. This Workstation alias name is used in the Gig GPScript. If you already have a different alias name for your Montage in Rig Manager, replace Workstation by your own alias name in the Gig GPScript hereafter.

  2. Then copy, paste the following code in the Gig Script Editor and compile:

Var
  Workstation         : MidiInDeviceAlias;
  sysexID, sysexValue : integer;
  sysexHeader         : string;

On SysexEvent(sm : SysexMessage) From Workstation

  sysexHeader = CopySubstring(""+sm, 0, 16);
  sysexID    = sm.SM_GetValue(8);
  sysexValue = sm.SM_GetValue(9);
  
  If sm.SM_Length()==11 && sysexHeader == "F043107F1C023040" && sysexID>=0x53 && sysexID<=0x5A
  Then    
    InjectMidiEventViaRigManager(Workstation, MakeControlChangeMessage(sysexID-0x53+12, sysexValue));
  Else
    InjectSysexEventViaRigManager(Workstation, sm);
  End
End

I hope it will compile and run properly as I cannot test it without a Montage.

If not, I will assist you in debugging. Then please make a screenshot with any error message and a screenshot of the Global MIDI Monitor window when acting on a Knob.

Please tell me also if it works for you. :nerd_face:

2 Likes

@David-san

Wow this is great and much better than my feeble attempt.

2 Likes

It works!!! Thank you so much! You’ve just created the perfect live setup for me…
No more extra controllers, just the montage! Incredible!

1 Like

Does it work for all the knobs?

YES it does!

1 Like

Hi,

I have no experience w/ scripts or programming, and just started working on this yesterday, so I’m currently floating in the sea without a lifejacket.

Unfortunately, like most or all Rolands, my V-Stage drawbars send sysex and not midi cc. I’ve been attempting to convert David-san’s script but Roland and Viscount are not quite sysexually compatible :wink:

I’d eventually like to convert most of the other V-Stage sysex buttons and knobs to cc also, but drawbars are at the top of the list.

Here is info and a gig file:

Roland Drawbar sysex conversion info: https://support.roland.com/hc/en-us/articles/115005704146-FA-06-FA-07-FA-08-Controlling-Drawbar-Settings-with-SysEx-Messages

Moving drawbar 1 (16’) my midi monitor says:

f0 41 10 01 06 00 12 02 20 01 00 08 55 f7
f0 41 10 01 06 00 12 02 20 01 00 08 55 f7
f0 41 10 01 06 00 12 02 20 01 00 08 55 f7
f0 41 10 01 06 00 12 02 20 01 00 08 55 f7
f0 41 10 01 06 00 12 02 20 01 00 08 55 f7
f0 41 10 01 06 00 12 02 20 01 00 07 56 f7
f0 41 10 01 06 00 12 02 20 01 00 07 56 f7
f0 41 10 01 06 00 12 02 20 01 00 07 56 f7
f0 41 10 01 06 00 12 02 20 01 00 07 56 f7
f0 41 10 01 06 00 12 02 20 01 00 07 56 f7
f0 41 10 01 06 00 12 02 20 01 00 07 56 f7
f0 41 10 01 06 00 12 02 20 01 00 07 56 f7
f0 41 10 01 06 00 12 02 20 01 00 07 56 f7
f0 41 10 01 06 00 12 02 20 01 00 07 56 f7
f0 41 10 01 06 00 12 02 20 01 00 07 56 f7
f0 41 10 01 06 00 12 02 20 01 00 07 56 f7
f0 41 10 01 06 00 12 02 20 01 00 06 57 f7
f0 41 10 01 06 00 12 02 20 01 00 06 57 f7
f0 41 10 01 06 00 12 02 20 01 00 06 57 f7
f0 41 10 01 06 00 12 02 20 01 00 06 57 f7
f0 41 10 01 06 00 12 02 20 01 00 06 57 f7
f0 41 10 01 06 00 12 02 20 01 00 06 57 f7
f0 41 10 01 06 00 12 02 20 01 00 06 57 f7
f0 41 10 01 06 00 12 02 20 01 00 06 57 f7
f0 41 10 01 06 00 12 02 20 01 00 06 57 f7
f0 41 10 01 06 00 12 02 20 01 00 06 57 f7
f0 41 10 01 06 00 12 02 20 01 00 05 58 f7
f0 41 10 01 06 00 12 02 20 01 00 05 58 f7
f0 41 10 01 06 00 12 02 20 01 00 05 58 f7
f0 41 10 01 06 00 12 02 20 01 00 05 58 f7
f0 41 10 01 06 00 12 02 20 01 00 05 58 f7
f0 41 10 01 06 00 12 02 20 01 00 05 58 f7
f0 41 10 01 06 00 12 02 20 01 00 05 58 f7
f0 41 10 01 06 00 12 02 20 01 00 05 58 f7
f0 41 10 01 06 00 12 02 20 01 00 05 58 f7
f0 41 10 01 06 00 12 02 20 01 00 05 58 f7
f0 41 10 01 06 00 12 02 20 01 00 04 59 f7
f0 41 10 01 06 00 12 02 20 01 00 04 59 f7
f0 41 10 01 06 00 12 02 20 01 00 04 59 f7
f0 41 10 01 06 00 12 02 20 01 00 04 59 f7
f0 41 10 01 06 00 12 02 20 01 00 04 59 f7
f0 41 10 01 06 00 12 02 20 01 00 04 59 f7
f0 41 10 01 06 00 12 02 20 01 00 04 59 f7
f0 41 10 01 06 00 12 02 20 01 00 04 59 f7
f0 41 10 01 06 00 12 02 20 01 00 04 59 f7
f0 41 10 01 06 00 12 02 20 01 00 04 59 f7
f0 41 10 01 06 00 12 02 20 01 00 04 59 f7
f0 41 10 01 06 00 12 02 20 01 00 03 5a f7
f0 41 10 01 06 00 12 02 20 01 00 03 5a f7
f0 41 10 01 06 00 12 02 20 01 00 03 5a f7
f0 41 10 01 06 00 12 02 20 01 00 03 5a f7
f0 41 10 01 06 00 12 02 20 01 00 03 5a f7
f0 41 10 01 06 00 12 02 20 01 00 03 5a f7
f0 41 10 01 06 00 12 02 20 01 00 03 5a f7
f0 41 10 01 06 00 12 02 20 01 00 03 5a f7
f0 41 10 01 06 00 12 02 20 01 00 03 5a f7
f0 41 10 01 06 00 12 02 20 01 00 03 5a f7
f0 41 10 01 06 00 12 02 20 01 00 03 5a f7
f0 41 10 01 06 00 12 02 20 01 00 03 5a f7
f0 41 10 01 06 00 12 02 20 01 00 03 5a f7
f0 41 10 01 06 00 12 02 20 01 00 02 5b f7
f0 41 10 01 06 00 12 02 20 01 00 02 5b f7
f0 41 10 01 06 00 12 02 20 01 00 02 5b f7
f0 41 10 01 06 00 12 02 20 01 00 02 5b f7
f0 41 10 01 06 00 12 02 20 01 00 02 5b f7
f0 41 10 01 06 00 12 02 20 01 00 02 5b f7
f0 41 10 01 06 00 12 02 20 01 00 02 5b f7
f0 41 10 01 06 00 12 02 20 01 00 02 5b f7
f0 41 10 01 06 00 12 02 20 01 00 02 5b f7
f0 41 10 01 06 00 12 02 20 01 00 02 5b f7
f0 41 10 01 06 00 12 02 20 01 00 02 5b f7
f0 41 10 01 06 00 12 02 20 01 00 02 5b f7
f0 41 10 01 06 00 12 02 20 01 00 02 5b f7
f0 41 10 01 06 00 12 02 20 01 00 01 5c f7
f0 41 10 01 06 00 12 02 20 01 00 01 5c f7
f0 41 10 01 06 00 12 02 20 01 00 01 5c f7
f0 41 10 01 06 00 12 02 20 01 00 01 5c f7
f0 41 10 01 06 00 12 02 20 01 00 01 5c f7
f0 41 10 01 06 00 12 02 20 01 00 01 5c f7
f0 41 10 01 06 00 12 02 20 01 00 01 5c f7
f0 41 10 01 06 00 12 02 20 01 00 01 5c f7
f0 41 10 01 06 00 12 02 20 01 00 01 5c f7
f0 41 10 01 06 00 12 02 20 01 00 01 5c f7
f0 41 10 01 06 00 12 02 20 01 00 01 5c f7
f0 41 10 01 06 00 12 02 20 01 00 01 5c f7
f0 41 10 01 06 00 12 02 20 01 00 01 5c f7
f0 41 10 01 06 00 12 02 20 01 00 01 5c f7
f0 41 10 01 06 00 12 02 20 01 00 01 5c f7
f0 41 10 01 06 00 12 02 20 01 00 00 5d f7
f0 41 10 01 06 00 12 02 20 01 00 00 5d f7
f0 41 10 01 06 00 12 02 20 01 00 00 5d f7
f0 41 10 01 06 00 12 02 20 01 00 00 5d f7
f0 41 10 01 06 00 12 02 20 01 00 00 5d f7
f0 41 10 01 06 00 12 02 20 01 00 00 5d f7

David-san’s slightly converted script is in loaded into Gig Script in my gig file. It wouldn’t compile so, w/ no scripting wisdom to foresee what consequences may occur, I changed ā€œmypatternā€ to ā€œpatternā€ 2x.

Thanks for any help!

script test 3526.gig (125.2 KB)

We are not in a position to officially debug userscripts (as we would be totally drowned :slight_smile: ) but I took a quick look at this one.

One issue stuck out immediately — you were comparing ā€œpatternā€ with itself, i.e. you wrote

if pattern == pattern

and that certainly won’t work. I changed your definitions slightly (see below) so you can try that.

Var
  vstage : MidiInDeviceAlias // Define viscount as a RigManager alias to the viscount controllervar pattern : String
var p : SysexMessage
var SysEx : String
var MidiCh : Int
var msb : Int
var lsb : Int
var value: Int
var ccmesg : ControlChangeMessage
var ccnum : Int
var desiredPattern: String = "F041"
    pattern : String

On SysexEvent(p: SysexMessage) from vstage
   SysEx = p
   MidiCh = SM_GetValue(p,2) - 48
   pattern = CopySubstring(SysEx, 0, 4)
   //Print(ā€œMyPattern= " + mypattern)
   if pattern == desiredPattern 
      then
         ccnum = SM_GetValue(p,5) + 46
         msb = SM_GetValue(p,6) << 7
         lsb = SM_GetValue(p,7)
         // Combine bytes and scale the CC
         value = (msb + lsb) * 127/255
         // Print (ā€œvalue = ā€ + value)
        ccmesg = MakeControlChangeMessageEx(ccnum, value, MidiCh)
        InjectMidiEventViaRigManager(vstage, ccmesg)
   End //if
End // On SysexEvent

Thanks dhj.

That didn’t change my drawbars’ misbehavior but is good to know that I’m spinning my wheels comparing apples to apples.

I’ll continue researching and maybe ask a question when I know something about how to do this. (if I don’t purchase Bome Pro 1st)

If anyone has pointers about variables needed to create scripts with Roland’s unique sysex output I’m all ears. Thanks.

As i understood the sysex code (according to your link to Roland’s support page for the FA-models), the position of a drawbar (snaps between 0 to 8) is represented in the SysEx by the value i marked above in bold.

Then, according to the MIDI implementation chart for the V-Stage models:

* [Organ Tone Modify]
+------------------------------------------------------------------------------+
| Offset | |
| Address | Description |
|-------------+----------------------------------------------------------------|
| 00 00 | 0000 aaaa | Upper Harmonic Bar 16' (0 - 8) |
| 00 01 | 0000 aaaa | Upper Harmonic Bar 5-1/3' (0 - 8) |
| 00 02 | 0000 aaaa | Upper Harmonic Bar 8' (0 - 8) |
| 00 03 | 0000 aaaa | Upper Harmonic Bar 4' (0 - 8) |
| 00 04 | 0000 aaaa | Upper Harmonic Bar 2-2/3' (0 - 8) |
| 00 05 | 0000 aaaa | Upper Harmonic Bar 2' (0 - 8) |
| 00 06 | 0000 aaaa | Upper Harmonic Bar 1-3/5' (0 - 8) |
| 00 07 | 0000 aaaa | Upper Harmonic Bar 1-1/3' (0 - 8) |
| 00 08 | 0000 aaaa | Upper Harmonic Bar 1' (0 - 8) |
| 00 09 | 0000 aaaa | Lower Harmonic Bar 16' (0 - 8) |
| 00 0A | 0000 aaaa | Lower Harmonic Bar 5-1/3' (0 - 8) |
| 00 0B | 0000 aaaa | Lower Harmonic Bar 8' (0 - 8) |
| 00 0C | 0000 aaaa | Lower Harmonic Bar 4' (0 - 8) |
| 00 0D | 0000 aaaa | Lower Harmonic Bar 2-2/3' (0 - 8) |
| 00 0E | 0000 aaaa | Lower Harmonic Bar 2' (0 - 8) |
| 00 0F | 0000 aaaa | Lower Harmonic Bar 1-3/5' (0 - 8) |
| 00 10 | 0000 aaaa | Lower Harmonic Bar 1-1/3' (0 - 8) |
| 00 11 | 0000 aaaa | Lower Harmonic Bar 1' (0 - 8) |
| 00 12 | 0000 aaaa | Pedal Harmonic Bar 16' (0 - 8) |
| 00 13 | 0000 aaaa | Pedal Harmonic Bar 8' (0 - 8) |

The adress of the particular drawbar might most probably be the highlighted value:
f0 41 10 01 06 00 12 02 20 01 00 08 55 f7
It should vary between 00 to 13, depending on which drawbar you are moving - just try & see…

So, the bottom line is that you’d have to scale the position value (0-8) to a corresponding CC-value (0-127), and this for each drawbar (00-13).

Maybe this helps a bit - unfortunately i can’t check the script right now…

2 Likes

Also Roland devices care about the proper checksum.

Does this really matter if it is only about ā€œreadingā€ the incoming SysEx from the device?
I guess, it doesn’t.

1 Like

Yes, this would only matter if you are converting CC from the plugin to control drawbar settings on the device.

I could probably script it but for me it is easier, to use Bome MIDI Translator Pro. I did a tutorial on this here.

1 Like