Page 1 of 2

How do i send two midi cc's with one button

Posted: 21 Apr 2013 01:32
by theinfinate
Probably a noob question but i can't figure out how to get a custom button to send twi midi cc's.
I want to have one cc sent when turned on and another cc when it is turned off. I figured out how to do this in bome's midi translator to send two key strokes but i'm sure it's something easy in Lemur.

Re: How do i send two midi cc's with one button

Posted: 21 Apr 2013 18:32
by Softcore
You can easily do that by adding a script in your object with if statements and the ctlout function.

For example

Add script on expression x, any

Code: Select all

if (x==0) ctlout(0, 21, 64, 1);
else ctlout(0, 22, 127, 1);
The above script will send on target 0, cc21 the value 64 on midi channel 1 if the button is switched off and on target 0, cc22 the value 127 on midi channel 1 if the switch is on. If you want,as i suspect you will be needing, to include more tahn one actions in your if statement (the above script doesnt mkae any sense because after two consequent presses nothing is changed, cc21 and cc22 are not changed anymore) include the actions in {}.

For example

Code: Select all

if (x==0) {ctlout(0, 21, 0, 1); ctlout(0, 22, 127, 1); }
else {ctlout(0, 21, 127, 1); ctlout(0, 22, 0, 1);}
Will switch on off the cc21 and cc22 but the one opposite with the other

Keep in mind a second way would be to add two scripts one on expression x, rising from 0 (up arrow) and one on expression x,dropping to zero ( down arrow ) which is essentially a way to seperate the off-to-on state of a switch from the on-to- off state.

Edit: typo in scripts corrected

Re: How do i send two midi cc's with one button

Posted: 22 Apr 2013 07:51
by theinfinate
Sorry to be a pain, i really appreciate your help! What am i doing wrong here? i presume the writing shown in red means that there is a problem?
And also can you have one button make a few buttons set to off?


Image

Re: How do i send two midi cc's with one button

Posted: 22 Apr 2013 08:36
by Softcore
Damnso silly of me, sorry!!!!

I should have typed if not If - the damn auto capitalisation of iPad!!!!

And yes, you figured correctly - red means something is wrong in the script, even if its just only a typo!!!

Re: How do i send two midi cc's with one button

Posted: 22 Apr 2013 08:37
by Softcore
As for making a button control other buttons, if you search the manual or the last, like, 10 of me replies you'll see its a very common question!!! ;)

Here is more on this subject

http://forum.liine.net/viewtopic.php?f=25&t=2891

Re: How do i send two midi cc's with one button

Posted: 22 Apr 2013 14:09
by theinfinate
thanks a lot for your knowledge but I'm just not getting it and i've been at it for the last couple of hours, i feel like a retard! Where you say CODE:SELECT ALL, is this just random what you call your script line or is it important, do you put this in when it asks,"create script"? but that comes up red when i type it all in caps like you have. Sorry but i've searched how to script but I need a Dummies version of how to script i think!

Re: How do i send two midi cc's with one button

Posted: 22 Apr 2013 14:15
by Softcore
Been in bed with flu for the last couple of days so my posts were made on the iPad and not actual testing....hold on a sec , im working on an example.....

But no, the name of the script is not important for its functionality - it is just given in the case you want to refer to it from another object....

Brb

Re: How do i send two midi cc's with one button

Posted: 22 Apr 2013 14:27
by Softcore
Ok just checked...after the edits the script is functional - probably you have missed a typo somewhere....

Here's an example with also a button that controls the dual CC button AAANNNNNDDDD lol, another button that inverts the way the second button controls the dual button.....

If you 've been using Bomes Im sure you ll get it right away - its just learning the script structure! ;)
dualCCbutton.jzml
(3.49 KiB) Downloaded 149 times

Re: How do i send two midi cc's with one button

Posted: 22 Apr 2013 14:36
by Softcore
Ok I see what caused the confusion, this right here.....

Code: Select all

some script or code here....
is a handy way of PHPBB forums to present codes for any purpose...It's mainly designed to give the forum members the way to post html, php or java codes without being executed so I have the habbit to include my Lemur scripts in it, even though its not necessary....I always thought it was common knolwedge and helps visually to distinguish code from text.

In other words, the "code: select all" is just there so that you can easily copy paste the code and has nothing to do with Lemur!

Re: How do i send two midi cc's with one button

Posted: 22 Apr 2013 14:47
by theinfinate
AHHHHHH your the man! I was using message on control change before, as soon as i change it to notes it works fine. I'm sort of getting it now, thanxs so much for getting out of bed, hope your flu gets better!