Quick question

Sarrova-Q

2017-01-05 12:58:09

Hello.

I need to toggle a momentary pad on a controller.
I have this code:

Code: Select all

pp=0
if ga==0 then Goto "ToggleOn"
if ga==1 then Goto "ToggleOff"
Label "ToggleOn"
ga=1
xx=127
exit rules, execute Outgoing Action
Label "ToggleOff"
ga=0
xx=0
exit rules, execute Outgoing Action
and velocity for my incoming controller pad messages is set to PP (to make them ignore the velocity sensitivity)

which works perfectly except when using these toggle buttons, it seems they react to each other:
If one toggle is engaged, I need to press the other pad twice instead of once to make it work.
Any ideas why that happens?

sjcaldwell

2017-01-05 14:26:26

Try this instead as it should be simpler

Code: Select all

pp=0
//Toggle value of ga
ga=ga^1
if ga==1 then xx=127
if ga==0 then xx=0
Do you have two separate translators doing the same thing? If so, what are you using to trigger each translator (incoming action)?
Also do you have any default routes set in your project that may be undoing what your translator is doing?

Maybe post you bmt file as information you provided might not be enough to figure out what is happening. Maybe turn on your log to see what is happining.

Sarrova-Q

2017-01-05 14:50:24

Hello. Thanks, your code is indeed simpler. I'm not using separate translators to do the same thing.
Here'smy BMT file:
Rules test.bmtp
(2.43 KiB) Downloaded 252 times
To explain better what happens, in sequential order:

I have to pads: pad A and pad B.

• if i press pad A, the LED goes on.
• if i press pad A again, the LED goes off.
• if i press pad B, the LED goes on.
• if i press pad B again, the LED goes off.
- OK -

• if i press pad A, the LED goes on.
• if i press pad B, the LED DOESN'T WORK.
• if i press pad B again, the LED goes on (second time I press).
• if i press pad B again, the LED goes off.
• if i press pad A again, the LED DOESN'T WORK.
• if i press pad A again, the LED goes off (second time I press).

sjcaldwell

2017-01-05 15:07:14

Well I've never used labels so not sure. If labels are local scope only (like local variables) it should work. Maybe they are not local?

Did my solution solve the interaction problem? I noticed that your translator 3 and 4 uses what I recommended.

I noticed you have a stop on each translator so I suspect that labels are not the problem. Just harder for me to keep track on what is going on with your logic. To me it looks like it should work

sjcaldwell

2017-01-05 15:09:56

Sarrova-Q wrote: • if i press pad A, the LED goes on.
• if i press pad B, the LED DOESN'T WORK.
• if i press pad B again, the LED goes on (second time I press).
• if i press pad B again, the LED goes off.
• if i press pad A again, the LED DOESN'T WORK.
• if i press pad A again, the LED goes off (second time I press).
You should have a translator set up to initialize all global variables to known state when the project is opened. Othewise they could be anything (they do not default to 0).

Sarrova-Q

2017-01-05 16:56:52

Hi thank you for your advice. Unfortunately, my problem still exists.
How do I set up "a translator to initialize all global variables to known state when the project is opened"?

I have no problem with trying that out, however I suspect there is something else at the root of this problem, as this 'malfunction' also exists after pressing the buttons several times. So resetting the begin state shouldn't have any effect, no?

Thank you!

sjcaldwell

2017-01-05 17:12:00

Try this
Attachments
Rules testa.bmtp
(2.98 KiB) Downloaded 250 times

Sarrova-Q

2017-01-05 21:15:10

Hey thanks!

Your patch didn't seem to work for some strange reason, but I noticed you used different values for the 'IF' rules each time.
I adjusted my preset with different values (ga, gb, gc, gd, ...) and now it works! Thank you so much!


Last questions: I noticed if you use different values for Incoming and Outgoing values (for instance incoming on note 36 and outgoing on note 73), Bome often automatically sets them to the same value. Why is this?

Also, the initialize preset doesn't work. I assigned ga=1 in the rules, but the LED doesn't go on when opening the project.
Rules test 3.bmtp
(2.06 KiB) Downloaded 226 times
EDIT:
Found it!
In your preset, one of the rules was
gc=gd^1
if gd==1 then xx=127
if gd==0 then xx=0

instead of
gd=gd^1
if gd==1 then xx=127
if gd==0 then xx=0

Thank you very much, sir!

sjcaldwell

2017-01-05 22:30:54

Yep just a typo from trying to do things to fast. Have fun!

Sarrova-Q

2017-01-06 13:24:04

Hello Sjcaldwell. Thank you so much.

I know I'm probably claiming your time, but could you answer one more thing for me?
(no one else is replying so I can only ask you I'm afraid).

I need to do the following.

PART 1
- when I push a pad on my controller it sends out a momentary midi note message.
- I need to transform this message into a toggle switch that sends out cc (value 0 and 127)
Solution (thanks to you!):
- Receive midi note message from controller, velocity set to 'any velocity'
- apply rules:

Code: Select all

ge=ge^1
if ge==1 then xx=127
if ge==0 then xx=0
- send out cc with value variable set to

Code: Select all

xx
PART 2
- when the DAW sends back midi to Bome, it sends a cc message that toggles between 0 and 127.
- I need to transform this message to a midi note message with velocity value 12 instead of 0 and 125 instead of 127 (to make different colors on my controller).

How can I do this?

ps:
Can I make a donation somewhere for you if you can help me?
Or do you need something else I can assist you with? (I'm great at mixing / mastering)

I appreciate your help!

sjcaldwell

2017-01-06 14:57:57

Try this

1) Trigger on any cc on the given channel
2) Set oo to the cc number (assuming different CC's for different notes)
3) set pp to the incoming velocity

In rules put the following. This will do the velocity conversion for you.

Code: Select all

qq=pp*8
qq=qq/9
qq=qq-12

The resulting formula is essentially output=input x 8/9 -12
Since BMT handles integers only it will be an approximation but between 12 and 124. If you want value 125 you would need to add after the above:

Code: Select all

if qq==124 then qq=125
Edit. Actually this would be better as the last line replacing the above

Code: Select all

if pp==127 then qq=125


For output
Send note oo value (which was incoming controller number) or set it to the note you wish if you don't want to use incoming controller number
Send velocity of qq (as shown above)

As far as donations, your timing is good because I just lost my job. Feel free to send me a private message and I will give you an email address you can send Paypal donation. Not necessary though, I'm more than happy to help!

Note, I have not tested it so looking forward to seeing the end result. Right now it is my best shot of paper solution.

florian

2017-01-30 06:54:33

sjcaldwell, sorry to hear that! I hope you get a lot of donations...

Sarrova-Q, just checking back -- have you been able to resolve your issue?

Sarrova-Q

2017-01-30 12:32:44

Hello, yes I was able to solve this. Sorry for the late reply.
Thanks for the fantastic help.

@sjcaldwell: pm send! edit: hmm apparently I can't contact you. Maybe because this is the old forum?

florian

2017-01-31 01:12:51

yes, PM's are turned off -- also because there had been an enormous amount of spam and fake logins in this forum.

sjcaldwell

2017-01-31 03:53:34

Sarrova-Q wrote:Hello, yes I was able to solve this. Sorry for the late reply.
Thanks for the fantastic help.

@sjcaldwell: pm send! edit: hmm apparently I can't contact you. Maybe because this is the old forum?
No problem. I appreciate the thought. That is enough for now. I'm sure I'll get another job soon. Actually I was notified that I have to leave my job but I'm still here for another 60 days as I "get" to train my replacement. Such fun in the business world.