Prophet VS preset help

Hello anyone reading this.

Been diving into making a preset for my Prophet VS Rack, and am having some success, but with a caveat, and I think I need help from someone more experienced.

So the Prophet VS uses non-standard NRPN messages with the msb and lsb flipped. I’ve managed to get all the parameters I’ve tried to respond (haven’t finished the full preset cause I want to tackle this issue first). One thing I keep running into is when I turn a knob, the correct parameter is brought up on the Prophet’s screen, and I can get the Param to respond fine with its full range, but when I then turn a different knob, it will make the last parameter adjusted jump away from the setting I had previously selected.

It seems like every new knob I turn changes the setting of the last parameter I touched. Any ideas wtf is happening there? I’m wondering if need to change the order of the hexadecimal bits beyond just swapping msb and lsb, but have no clue how to do that (I think Lua can do this, but I don’t know Lua). Anyone willing to bang their head against this with me? I can provide the manual for the prophet vs!

Thanks in advance to anyone willing to help!

for more context, the VS uses CC63 is the param select LSB, CC 62 as the param select MSB, CC06 as the data entry MSB, and CC26 as the data entry LSB. The VS wants it in a weird order, and I need to send the data like this (I have the VS set to midi channel 11, and this is a 1-way connection between electra and VS for now:

Param Select LSB=|B11, 62, param number|
Param Select MSB=|B11, 63 param number|
Data Entry LSB=|B11, 26, value|
Data Entry MSB=|B11, 06, value|

I was looking at the simpleNRPN Lua script created by NewIgnis, and made some adjustments to this format… does this look right?

function simpleNRPN(ValueObject, value)
local message = ValueObject:getMessage ()
local parameterNumber = message:getParameterNumber ()
–print (parameterNumber )
local paramMSB=00
midi.sendControlChange (Port 1 , Channel 11 , 62, parameterNumber- 128*paramMSB)
midi.sendControlChange (Port 1 , Channel 11 , 63, paramMSB)
midi.sendControlChange (Port 1 , Channel 11 , 26, value)
midi.sendControlChange (Port 1 , Channel 11 , 6, value)
end

Sorry I have no clue what I’m doing in Lua

No it doesn’t.

I’d say provide me your Prophet and I’ll have a look at it :grin:
But do attach your preset and the manual here.

Surely me or somebody else will help you out.

Haha, figured it was wrong.
here is the private preset. the only parameter where I tried to implement your script was A WAVEFORM on page 1. I didn’t have time to test it and see that I failed yet though :slight_smile:

https://app.electra.one/preset/xhybV5tX0tOaqEzJriEA

Manual below, Midi info starts on page 103 of the PDF:

If you would consider helping me to just get that parameter to work, I can try and figure the rest out. I think my issue is that the electra isn’t ending the control message with the data entry MSB, because the manual clearly says it needs to end with that bit. I’m pretty sure that’s why I’m having the issue where every knob I touch make the previous parameter I adjusted jump, cause when I move the new knob an MSB gets received. But clearly my lack of Lua knowledge makes it tricky for me to figure out how to swap around the order of bit delivery.

Insert this in lua and replace all lua with it

Try it out. If it works , I’ll explain and let you change some other things (for instance you will regret having hardcoded the port and the channel, if later on you want to change it).
Do learn about LSB and MSB in the meantime if that is unfamiliar terrain, that’ll help you in your future endeavours.


-- display functions ---------------------------------------------------------------------

--[[function displayChar (valueObject, value)
  return string.char(value)
end
]]

-------------------------------------------------------------------------------------------------

function simpleNRPN1(ValueObject, value)
  local message = ValueObject:getMessage ()
  local parameterNumber = message:getParameterNumber ()
  --print (parameterNumber )
  midi.sendControlChange (Port 1 , Channel 11 , 62, parameterNumber%128) -- parameter LSB
  midi.sendControlChange (Port 1 , Channel 11 , 63, math.floor(parameterNumber/128)) -- parameter MSB
  midi.sendControlChange (Port 1 , Channel 11 , 26, value%128) -- value LSB
  midi.sendControlChange (Port 1 , Channel 11 , 6, math.floor(value/128)) -- value MSB
end

hmm unfortunately that didn’t work. When I use that script, should I be configuring the fader object as virtual like you do in the summit preset?

I’ll check tomorrow

Certainly no rush! I appreciate you helping at all!!

It’s certainly easier when seeint in front of the equipment.

Here’s working code. Try this

function simpleNRPN1(valueObject, value)
  local message = valueObject:getMessage ()
  local parameterNumber = message:getParameterNumber ()
  --print (parameterNumber )
  midi.sendControlChange (PORT_1 , 11 , 62, parameterNumber%128) -- parameter LSB
  midi.sendControlChange (PORT_1 , 11 , 63, math.floor(parameterNumber/128)) -- parameter MSB
  midi.sendControlChange (PORT_1 , 11 , 26, value%128) -- value LSB
  midi.sendControlChange (PORT_1 , 11 , 6, math.floor(value/128)) -- value MSB
end

So what made the difference:
in midi.sendControlChange you need to provide 4 numbers:

  • the first one is the port, but the entry Port 1 is not a valid value, it’s text. 0 would be valid as it stands for port 1, 1 is also valid and it stands for port 2. But better is to use the “globals” that the E1 provides, such as PORT_1 or PORT_2. That way you not need to memorize the actual value.
  • the second one is the channel, that should be a number between 1 and 16. Channel 11 is not a valid number, it’s a string.

When you need to split a number into its 7-bit MSB and 7-bit LSB part:

  • divide the number by 18 and retain the integer part, to get to the 7 Most Significant Bits: math.floor(value/128)
  • use the modulo function value%128 : it throws away all multiples of 128, so only the remainder is retained which are your 7 Least Significant Bits

hmm this still didnt work at all, the prophet doesnt respond to it. if i remove the script and set it back to nrpn it works again, but i still run into the issue of it needing the data entry msb last. what could i be doing wrong?

https://app.electra.one/preset/xhybV5tX0tOaqEzJriEA/edit

this is the preset with A WAVEFORM set up as a virtual signal with the lua script.

Well, the code works fine at my side. But I see what is wrong; the CC-numbers are wrong.

  • 62 is hex for 98
  • 63 is hex for 99
  • 26 is hex for 38
  • 6 is hex for … well 6
    When you intend to write a value in lua in hex , you must prefix it with 0x, if not lua will consider it as a integer.

So there are two ways to resolve:
1) change the values into integers:

function simpleNRPN1(valueObject, value)
  local message = valueObject:getMessage ()
  local parameterNumber = message:getParameterNumber ()
  --print (parameterNumber )
  midi.sendControlChange (PORT_1 , 11 , 98, parameterNumber%128) -- parameter LSB
  midi.sendControlChange (PORT_1 , 11 , 99, math.floor(parameterNumber/128)) -- parameter MSB
  midi.sendControlChange (PORT_1 , 11 , 38, value%128) -- value LSB
  midi.sendControlChange (PORT_1 , 11 , 6, math.floor(value/128)) -- value MSB
end
  1. change the values into hex:
function simpleNRPN1(valueObject, value)
  local message = valueObject:getMessage ()
  local parameterNumber = message:getParameterNumber ()
  --print (parameterNumber )
  midi.sendControlChange (PORT_1 , 11 , 0x62, parameterNumber%128) -- parameter LSB
  midi.sendControlChange (PORT_1 , 11 , 0x63, math.floor(parameterNumber/128)) -- parameter MSB
  midi.sendControlChange (PORT_1 , 11 , 0x26, value%128) -- value LSB
  midi.sendControlChange (PORT_1 , 11 , 0x06, math.floor(value/128)) -- value MSB
end

Ok so… you were totally right that I was counting in base10 instead of hex. once I adjusted the param select LSB/MSB to 98/99 it did the trick kind of. While it brought the correct parameter up on the screen, it wouldn’t actually change the parameter value. Then I noticed the VS manual says it really only needs the value MSB in the message, so I deleted the value LSB code line, and removed the math in the MSB line and simply changed it to value, and voila, it works great!

this is the change I made to get it to work:

1 Like

now the next thing i need to figure out is why list and toggle objects don’t work with this script, only faders. I have quite a few parameters I’d like to convert to lists/toggles, so if you have any ideas on how I can get those to work with this script, I’d appreciate any pointers.

that being said, the preset now does what i need it to do, so I’m super happy even if I cant figure out the toggle/lists.

there’s another improvement you better do right away and get accustomed to: do not hardcode the port or the channels in the lua.
It’s a nigthmare to debug, when you decide to change the channel.

The trick is simple:

at the start of lua add the following, whereby you replace x by the devide number you chose for the controls. I usually always use 1 (regardless of channe), but I guess you used11:

deviceId = x -- the device ID used in the E1 preset
device = devices.get(deviceId)
devPort = device:getPort()
devChannel = device:getChannel()

Then in the NRPN function, you exchange the hardcoded constants for those new variables:

function simpleNRPN1(valueObject, value)
  local message = valueObject:getMessage ()
  local parameterNumber = message:getParameterNumber ()
  midi.sendControlChange (devPort , devChannel , 98, parameterNumber%128) -- parameter LSB
  midi.sendControlChange (devPort , devChannel , 99, math.floor(parameterNumber/128)) -- parameter MSB
  midi.sendControlChange (devPort , devChannel , 0x06, value) -- value MSB
end

As for lists and toggles, check what value the synth is sending . Some synths will f.i. toggle between 0 and 127, others between 0 and 64, and also 0/1 is common.

Then make sure you send out those same values from the E1.

If using a 1 way connection between Electra and the VS, will the above code still work? I have the Electra controlling about 6 things, but I’ve had midi feedback loop issues in the past when I try to route any of the instruments back in.

So I’m just wondering if this method for not hardcoding the port/channel will still work if I don’t have a midi handshake happening?

Yes, it’s not related