|
Post by mo13 on Feb 16, 2022 9:15:30 GMT
You could use Pitch Bend. There are some limitations. Only one Pitch Bend per MIDI channel, so not quite as simple as CC# to manage. Pitch Bend normally defaults to the middle value (8192, hex 2000), indicating 0 pitch change, with zero meaning max negative, and 16381 (3FFF) meaning max positive. If the controller just converts knob rotation into Pitch Bend, that should be fine. The resolution won't be any better than MSB/LSB, just a different way of transmitting it. Also, of course, many apps and hardware respond to Pitch Bend, so you'd need to make sure they don't see these messages. The resolution was already increment-perfect on your earlier Disting script so if that would be achievable by faders that send out Pitch Bend that would be great. I still haven't received the device but in the meantime the maker sent me a more in depth manual, you mentioned that it's 1 PB per channel, but if I interpet this correctly, the way hes talking about how it's set up here, is that every same channel number can send PB through CC127, but i might be mistaken ofcouse or setting up PB on different channels is a necessity?  I studied your Disting script a little to see if I could change things around there to replace MSB/LSB with PB to SysEx but unfortunately I'm stil not confident enough to modify those rules. to summerize, all the parameters that are on the receiving end of Disting stay the same but instead of MSB/LSB encoders I now have 6 faders that send PB. would be good to hear your thoughts on this!
|
|
|
Post by uncledave on Feb 16, 2022 10:56:59 GMT
The device is fudging to use CC#127 to set the Pitch Bend channel. When that control sends Pitch Bend messages, they will be on that MIDI channel. There can only be one Pitch Bend on each channel; there is no PB "number", the message is just the command code and the two value bytes. This makes sense for normal keyboard controllers, since each keyboard has only one PB wheel.
I can modify the script. It's more about taking stuff out than adding anything. I'll make it take PB on a sequence of channels, and send a sequence of Disting parameter numbers.
|
|
|
Post by mo13 on Feb 16, 2022 12:28:58 GMT
The device is fudging to use CC#127 to set the Pitch Bend channel. When that control sends Pitch Bend messages, they will be on that MIDI channel. There can only be one Pitch Bend on each channel; there is no PB "number", the message is just the command code and the two value bytes. This makes sense for normal keyboard controllers, since each keyboard has only one PB wheel. I can modify the script. It's more about taking stuff out than adding anything. I'll make it take PB on a sequence of channels, and send a sequence of Disting parameter numbers. all cleared up @pb! so in practice I just need to setup for instance channels 7-12 to CC 127. then with the new script modification the rest follows as before for corresponding 6x 16bit out to Disting correct?
|
|
|
Post by uncledave on Feb 16, 2022 15:39:21 GMT
The device is fudging to use CC#127 to set the Pitch Bend channel. When that control sends Pitch Bend messages, they will be on that MIDI channel. There can only be one Pitch Bend on each channel; there is no PB "number", the message is just the command code and the two value bytes. This makes sense for normal keyboard controllers, since each keyboard has only one PB wheel. I can modify the script. It's more about taking stuff out than adding anything. I'll make it take PB on a sequence of channels, and send a sequence of Disting parameter numbers. all cleared up @pb! so in practice I just need to setup for instance channels 7-12 to CC 127. then with the new script modification the rest follows as before for corresponding 6x 16bit out to Disting correct? Yes, you'll change each fader to "send" CC127, and set the channel. It will actually send Pitch Bend on that channel. Here's the script. As you can see, it's much simpler because we don't have to handle pairs of CC messages. We just receive PB and send SysEx with the same data. Need to be careful about byte ordering, tho'. It handles any six consecutive channels for the Pitch Bend. I've made it 0..5, but you can adjust as you wish. The Disting parameter numbers are determined by a table, so you can set them to whatever values you choose. #DistingSelectPB # Receives a Pitch Bend value and sends it to # Disting EX as a set parameter SysEx message. # Route script output to a MIDI connection to disting. # Remember, all numbers are hex, unless $xx. # We assume the Pitch Bend channels follow in sequence. # Disting parameter numbers are given by a table. You can adjust # them as desired. # Note the separation of variable names: Ki for constants, # Ji for saved values, Ii for temp values. Aliases make the # program more readable, since we don't have to remember # the array indices.
If load # Note: the channel number is the actual message value (range 0..F), # not the MIDI channel number (range 0..$16). Alias 0 baseChan # Channel number for the first parameter Alias 6 numParams # number of parameters
# Disting parameter numbers corresponding to each channel. # Edit as desired, don't forget the $. Ass K10 = $7 $8 $9 $10 $11 $12 # No adjustable values below this line ——————————————————— Set Name DistPB
Alias 10 paramBase Alias I00 reg0 Alias I01 reg1 Alias I10 temp0
# display the parameter and value and add to monitor stream Sub ShowData theParam theMSB theLSB Mat temp0 = 80 * theMSB Mat temp0 = temp0 + theLSB Set LB0 theParam +D Set LB1 temp0 +D Log Param theParam +D Log Value temp0 +D End
End # Initialization ———————————————————————————
# this blocks any PB messages. Anything else passes through. If MT == E0 # handle PB message If MC >= baseChan # require channel in expected range Mat reg0 = MC - baseChan If reg0 < numParams # get the parameter number from the table Mat I0F = reg0 + paramBase Ass reg0 = KI0F # diagnostic display ShowData reg0 M2 M1 # send SysEx msg to set parameter. Order of values in # PB is LSB, MSB. Snd F0 00 21 27 5D 46 reg0 00 M2 M1 F7 End End Block End
|
|
|
Post by mo13 on Feb 16, 2022 16:36:35 GMT
tested with EC4 encoders which we used with previous script but now sending out PB and works flawless! now awaiting for the faderbank to arrive so will report back on that, but can't think of a reason why it would be different, unless the faders have less 'room to move' then endless encoders. Another quik question, like with the previous MSB/LSB setup/script, there I had the upper value set to 008 so the increment stops at 1032. Is there any way to add that to this script? as Disting only handles 1000 samples so there is no need to go over that, and I won't be able to set an upper PB value on the new faderbank. Precicely 1000 would be even better but I have no idea what the possibilities are with this?
|
|
|
Post by uncledave on Feb 16, 2022 16:51:50 GMT
Hmmm. Good point. Right now we're sending the full PB range, 0..16383, so the first 1000 are right at the beginning. We could easily scale it down to run exactly 0..999. As I remember, that would be correct, that the highest value is 999 (not 1000). I'll put that in. We could have done that in the old script, if we had thought about it.
|
|
|
Post by mo13 on Feb 16, 2022 16:56:45 GMT
nice! indeed it's 0-999
|
|
|
Post by uncledave on Feb 16, 2022 18:33:08 GMT
Here we go. This is a bit more complicated because we need to work with the combined 14-bit value. I made it so it only transmits when the value changes, so it doesn't keep setting the same parameter. #DistingSelectPB # Receives a Pitch Bend value and sends it to # Disting EX as a set parameter SysEx message. # Route script output to a MIDI connection to disting. # Remember, all numbers are hex, unless $xx. # We assume the Pitch Bend channels follow in sequence. # Disting parameter numbers are given by a table. You can adjust # them as desired. # Note the separation of variable names: Ki for constants, # Ji for saved values, Ii for temp values. Aliases make the # program more readable, since we don't have to remember # the array indices.
If load # Note: the channel number is the actual message value (range 0..F), # not the MIDI channel number (range 0..$16). Alias 0 baseChan # Channel number for the first parameter Alias 6 numParams # number of parameters Alias $999 maxValue # value corresponding to max PB value
# Disting parameter numbers corresponding to each channel. # Edit as desired, don't forget the $. Ass K10 = $7 $8 $9 $10 $11 $12 # No adjustable values below this line ——————————————————— Set Name DistPB
Alias 10 paramBase Alias I00 reg0 Alias I01 reg1 Alias I10 temp0
# this value cannot happen # these registers store the last value sent for each parameter Ass J00 = 4000 4000 4000 4000 4000 4000 4000 4000 4000
# combines two 7-bit bytes into a 14-bit value. Result must be 16-bit. Sub CombineBytes result LSB MSB Mat result = 80 * MSB Mat result = result + LSB End
# splits the give 14-bit value into low and high bytes Sub SplitBytes LSB MSB value Mat LSB = value & 7F Mat MSB = value / 80 End
# display the parameter and value and add to monitor stream Sub ShowData theParam theValue Set LB0 theParam +D Set LB1 theValue +D Log Param theParam +D Log Value theValue +D End
# scales the given 14-bit value to the given maximum, returning # the updated value. This method creates Max+1 value bands, # numbered 0..Max, with the first and last being half size. # This is suitable for a discrete (integer) parameter. Sub ReScale theValue theMax Mat P0 = theMax * theValue Mat P0 = P0 + 2000 # ensure rounding (like adding 0.5) Mat theValue = P0 / 4000 # scale down End
End # Initialization ———————————————————————————
# this blocks any PB messages. Anything else passes through. If MT == E0 # handle PB message If MC >= baseChan # require channel in expected range Mat reg0 = MC - baseChan If reg0 < numParams # Order of values in PB is LSB, MSB. CombineBytes reg1 M1 M2 # combined 14-bit value ReScale reg1 maxValue # scale to given maximum # only process if scaled value changed If reg1 != JI00 # save the new value Ass JI00 = reg1 # get the parameter number from the table Mat I0F = reg0 + paramBase Ass reg0 = KI0F # diagnostic display ShowData reg0 reg1 # send SysEx msg to set parameter. SplitBytes M1 M2 reg1 Snd F0 00 21 27 5D 46 reg0 00 M2 M1 F7 End End End Block End
|
|
|
Post by mo13 on Feb 17, 2022 11:33:29 GMT
fantastic work again! as it turns out, the Disting can hold a total of 1000 sounds in ram, that means I can choose max.166 samples per one of the 6 folders, I inquired about this and the answer was fair enough that if it would be extended then it would reduce the reliability. Would you be kind to adjust the 0-999 to 0-165, I'll still have a good use of the 0-999 script if I'm working from a single large folder
|
|
|
Post by uncledave on Feb 17, 2022 12:36:13 GMT
Hi. You can do it yourself. Just change the maxValue alias from $999 to $165. Remember to Install Rules before saving.
|
|
|
Post by mo13 on Feb 17, 2022 12:52:03 GMT
Hi. You can do it yourself. Just change the maxValue alias from $999 to $165. Remember to Install Rules before saving. oops was in front of me the whole time, good lesson. I just successfully added another SysEx command to your script, glad it worked right away! 
|
|
|
Post by uncledave on Feb 17, 2022 14:34:56 GMT
Excellent! And yes, we could add a whole slew of those SysEx messages, each tied to a different input (CC, etc.). Could even use one control to select a parameter, and another control to set the value, whatever. Have (not too much) fun!
|
|
|
Post by mo13 on Feb 23, 2022 18:36:03 GMT
I finally received the faderbank for PB to SysEx purposes and it's been quite a day @ fine tuning these settings to match your script, but I got there!  if this is of any insight help, the above is what ended up matching your script perfectly, the factory settings were - min.value - 40, max. 8100 as I speculated, using faders is a bit of a different game compared to endless encoders @ec4, way more sensitive but not unhandleable either, cheers again!
|
|
|
Post by uncledave on Feb 23, 2022 23:32:35 GMT
Hmmm. My script does not do anything special with the data. The Pitch Bend message contains a value between 0 and 16383, with 8192 in the middle representing zero pitch bend. In hex, this is 0 and 3FFF, with 2000 in the middle. We just take that big number, between 0 and 16383, and scale it down to between 0 and 999. If you use the MidiFire MIDI monitor, you should see those pitch bend messages coming from the controller. The two data bytes should vary between (0,0) and (7F,7F), with (0,40) in the middle (order is LSB, MSB).. So whatever you've had to adjust was needed to bring the data to that range.
|
|
|
Post by mo13 on Mar 1, 2022 9:21:37 GMT
So whatever you've had to adjust was needed to bring the data to that range.
yeah that's what I implying, as you can read from the image it says that some faders may have a dead zone, which in this case varied on all the 6 faders, and especially because of PB sensitivity it being more 'jumpy' so I just had to recalibrate it so all faders end up starting from values 0-165
|
|