Why does this conditional operation not work?

Discuss problems and solutions.
Post Reply
FriFlo
Newbie
Posts: 31
Joined: 07 Dec 2011 17:49

Why does this conditional operation not work?

Post by FriFlo »

I have a Fader object and its midi input and output are disabled. Then I create a script "On Expression, Fade.x" to get feedback to the fader from a hardware midi controller sending pitchbend:

Code: Select all

midiout(1,{224,1,Fader.x*127});
This works! Then I create a script"On Midi, Pitchbend, Channel 1" to output midi pitchbend:

Code: Select all

setexpression(Fader,'x',MIDI_ARGS[0]/16000);
Ok, now I get midi output from the Fader in Lemur. However, I also get doubled midi output from feedback sent to the fader, which is not how I want it. Well, this is why I created the condition in the first script:

Code: Select all

if(Fader.z>0) midiout(1,{224,1,Fader.x*127});
This should theoretically only send the mid out, as long as I touch the fader. But instead, the midi gets sent out anyway ... I don't understand why?!
Phil999
Regular
Posts: 919
Joined: 11 Jan 2012 01:53

Re: Why does this conditional operation not work?

Post by Phil999 »

not sure about that, but I would think that if you add the line

Code: Select all

else return
it should work as you want.
Formant+Eurorack, PPG wave 2.2, Korg MS-20, etc., EWI 4000s, QuNeo, etc., Mixbus32c, u-he, MadronaLabs, Samplemodeling, NI, etc., iPad2/4/Pro
FriFlo
Newbie
Posts: 31
Joined: 07 Dec 2011 17:49

Re: Why does this conditional operation not work?

Post by FriFlo »

Thanks for trying! Actually, that line is not necessary with any other conditional expressions.
But I tried it anyway. It didn't help ... I can't figure out why ... it seems so obvious it must work!
FriFlo
Newbie
Posts: 31
Joined: 07 Dec 2011 17:49

Re: Why does this conditional operation not work?

Post by FriFlo »

I think I figured it out: With every Midicommand triggering the Fader.x value via script, the fader automatically sends a Fader.z=1 value. SO, it seems, there is no way to trigger a fader or knob without triggering touch with it, although you actually did not touch the fader ...
Bad news ...
Post Reply