How to use one MIDI cc button to cycle thru multiple program changes sends

0
0

I’m a newbie to this software (MIDI translator pro). I have a basic understanding. However, the rules and scripting, I have absolutely no knowledge of. It seems really confusing. Any help of where to start would be greatly appreciated.

Im trying to use one MIDI CC button to cycle through 10 different out going program change messages. So for example:

1:) MIDI CC 24 button is pressed – MT sends program change MBS 63 LSB 00

2:) Midi CC 24 is pressed again – MT sends program change message MSB 63 LSB 01

3:) MIDI CC 24 is pressed again – MT sends programs change message MSB 63 LSB 02

4:) Ect…

5:) Once MIDI CC 24 cycles through all 10 program messages I need it to start from the beginning of the list again.

 

These aren’t the exact MIDI numbers but I think you get the idea of the functionality I need. Any help would be greatly appreciated. Thank you

 

Marked as spam
Posted by (Q&A Forum: 1, Answers: 2)
October 30, 2017 9:34 pm
44 views
0
Private answer

Well, tt=pp<<7 and tt=tt||qq is a bit beyond the scope of the board but trust me it work. It is bitwise integer manipulation. The key is the pp would be your MSB and tt woud be you lsb and at the end, tt is now the combined value for use by the translator for output.

ga=ga+1 simply increments the program number you want but in your second example you don’t use sequential numbers so you would you would have to use that just as a pointer to the next one you want.
I’ll give you the logic for your first request (or it should be close but it is not tested).
Maybe you can test it and tweak it from there if needed.

// Local varables used
// pp = counter used within the translator
// oo = MSB of bank
// tt = LSB of bank and then later total bank number
// rr = program number
// Global variables used
// ga = program counter persistent across iterations

// get the value of the counter
pp=ga
//increment it
pp=pp+1
//set msb
oo=63
//shift into position
oo=oo<<7
// set lsb
tt=5
// Override lsb for the last 2
if pp==>6 then tt=0
// combine them to form the bank
tt=oo|tt
// Now lets assign the program you will be using
if pp==1 then rr=65
if pp==2 then rr=76
if pp==3 then rr=105
if pp==4 then rr=88
if pp==5 then rr=89
if pp==6 then rr=91
if pp==7 then rr=83
if pp==8 then rr=92
// reset counter
if pp>8 then pp=0
// put the counter back into global variable
ga=pp
if pp==0 then exit rules, skip outgoing action

 

Output
Program change bank tt value rr

For your second one, it would be similar but you will need to create a different global variable such as gb instead of ga so that the counters do not interfere with each other.

Steve Caldwell

 

Marked as spam
Posted by (Q&A Forum: 22, Answers: 1005)
October 31, 2017 5:37 pm

If you want to learn more about bit shifting, you can do a search on “bit shift operators”. The following might be helpful:
https://stackoverflow.com/questions/141525/what-are-bitwise-shift-bit-shift-operators-and-how-do-they-work

( at October 31, 2017 7:11 pm)

Steve, thanks again for another great explaination.

I pretty much got it to work with the help of the tutorials and your template and explanations. I’m gonna dig in the bit thread you sent.

I have a question. From using your code logic. If I replaced the “LSB tt=5”with tt=8. It would totally change the bank, meaning it should land on a different preset. I tried that and it did not work. I’m wondering does that have something to do with the bit information?

Also I couldn’t get the last 2 preset changes to work because it’s something going on with the LSB (tt). It seem to be staying at a value of 5 no matter what. I’m gonna mess around with it some more and try some new stuff. Thanks for all the help. I would still be lost without it….

( at October 31, 2017 10:13 pm)

Well if you set tt=8 it should land on 8 when pp

( at October 31, 2017 10:22 pm)

I found out the problem. I never assigned tt to the bank change in outgoing actions. This is working great now. Steve, thanks so much.

( at November 1, 2017 12:52 am)

Glad to have been of help!

( at November 1, 2017 12:56 am)
0
Private answer

Thanks Steve for your explaination.

I some what get your explaination how it would cycle through 10 program changes. I really don’t get how you came to the bit information. tt=pp<<7 & tt-tt |qq ??? Really scratching my head on that one. I spent the whole night with it and I still can’t get it.

 

 

I was thinking to approach this by multiple translators. If I laid out 8 translators, all with output actions going to the indicated program change presets. (as shown in my 2nd example). The only thing I can’t understand is how the global variable would switch between the different translators in the preset. How would it count how many times I hit the button?

If I wrote ga+1 in each of the translators would it count the number of times I hit the button?  Am I on the right track?

 

Marked as spam
Posted by (Q&A Forum: 1, Answers: 2)
October 31, 2017 4:26 pm
0
Private answer

I think maybe a bit of an explanation of rules will be in order for a first time.

 

Global variables can be shared between translators  and are generally used to store values that need to be either viewed or changed across the project.  See the section on global variables in the  manual.

Exampls of globals are ga gb gc  starting with letters g-n and y-z.

If there is something that needs to be done only within a translator you use local variables, they do not retain their values between iterations. They always have the same letters. I think they start with oo and go to xx.

Examples are pp qq rr … ww

Variables are used store values you want to use for your translators and are always signed intergers like

-1 -5  5 1 100 500 etc. The point is there is no decimal point

 

Now lets look at the rules

Anything starting with a // double slash is a comment and are handy so you can document your code.

//Bank Select
//msb  This is the MSB  (most significant byte) you indicated in your first request I store it in a local variable I decided to call pp
pp=63
//lsb This is the LSB  that I assumed based on your first request
qq=0
// Total bank MSB and LSB

// To create a full number we need to put the MSB and LSB together. MIDI only allows for 7 bits so I shift the MSB value up to put it in the correct bit position. I assign a variable (local) tt to that value
tt=pp<<7

// Now I  OR the bits with the value of the LSB . The net is that the bytes are now combined properly to make a full integer for the bank number you want
tt=tt|qq

// program number Here I take the last value of gd (gd being a global value and increment it by 1 for each button press. Global variables are guaranteed to always have a value of 0 at program start. I assigned this a temporary value in the local variable rr
rr=gd+1
// Set maximum here Since we only want 10 programs 0-9. Once I reach program 9, on next button push I want to start at 0 again
if rr>9 then rr=0

// Now I put the new value back into the global variable so it can be used again for the next button press. I could have just as easily worked with only ga and not used rr. I just decided to use a local variable as a matter of style I try to only change global variables at the end of rules. It make them easier to find if the rules get long.

gd=rr

Then at the end of rules you assign the variables you created to the output message.

 

That about sums it up. I hope this helps!

Steve

Marked as spam
Posted by (Q&A Forum: 22, Answers: 1005)
October 31, 2017 5:29 am
0
Private answer

Hi, I can either teach you how to do it here by explaining pp qq ….  and you can supplement that with reading the manual or watching our tutorials. Or if you want me to program in for you without needing to learn, you can reach out to me as an independent Bome programming specialist and I can program it for you for a fee.

 

You and find the manual by pressing help within MT Pro.  The tutorials are at the link below. There are 32 of them and the first two should be enough to give you a feel for how MT Pro works and what this all means.

 

https://www.youtube.com/playlist?list=PLzwHsH6-VZ8Qy_dxsf0LqorjarvnDIFiy

My email address is below:

Steve

bome@sniz.biz

Independent Bome Programming Specialist

Bome Q&A moderator

 

Marked as spam
Posted by (Q&A Forum: 22, Answers: 1005)
October 31, 2017 3:23 am
0
Private answer

Thank you for your quick response. I’m totally lost. I don’t know what the template rules mean. Like pp? Or qq?

I’m gonna give you exactly the way I need it to Function with actual settings.

Midi CC Button  “B0 5C 70”  (Cycles the following Program Change presets)

1:) MSB 063      LSB 005     Program No. 065

2:) MSB 063     LSB 005     Program No. 076

3:) MSB 063     LSB 005     Program No. 105

4:) MSB 063     LSB 005     Program No. 088

5:) MSB 063     LSB 005     Program No. 089

6:) MSB 063     LSB 005     Program No. 091

7:) MSB 063     LSB 000     Program No. 083

8:) MSB 063     LSB 000     Program No. 082

 

I apologize if it’s a lot. I really don’t understand the scripting.  Can you please advise a good place (The manual is not helping) to start so I can dig deeper into this program? I’m hoping I can understand a little more when I look at where and how you plug these numbers in the “Rules”. Thanks in advance for you help.

 

I also need the Midi Button B0 5C 20  (To Cycle The Following Program Change Presets)

1:) MSB 063      LSB 010      Program No. 085

2:) MSB 063      LSB 013      Program No. 095

3:) MSB 063      LSB 010      Program No. 038

Marked as spam
Posted by (Q&A Forum: 1, Answers: 2)
October 31, 2017 2:05 am
0
Private answer

Hi, and welcome to the wonderful world of Bome!

For input you take your controller. But I think you have that figured out.

I assume you really want MSB always 63 and LSB always 0 and then cycle your program number only.

I created a project from a template and set the global variable gd to cycle through your program changes.

Here are the rules:

//Bank Select
//msb
pp=63
//lsb
qq=0
// Total bank MSB and LSB
tt=pp<<7
tt=tt|qq

// program number
rr=gd+1
// Set maximum here
if rr>9 then rr=0
gd=rr

I then output the program number with the bank and program number  based on the bank and program number of gd

 

Here is the project file.

Feel free to let us know if you have any further questions.

 

Steve

bome@sniz.biz

Independent Bome Programming Specialist

Bome Q&A moderator

 

Marked as spam
Posted by (Q&A Forum: 22, Answers: 1005)
October 30, 2017 10:02 pm