Variable not sent via OSC

Discuss problems and solutions.
Post Reply
Romang
Newbie
Posts:5
Joined:13 Jul 2012 17:55
Variable not sent via OSC

Post by Romang » 13 Jul 2012 18:16

Hi guys!
Having a trouble here:
Lemur is not sending variable defined inside the script through OSC to Ableton Live.

I've defined "b" variable in "Quant_switch" Object:
Image

And I have a "Quant" script which defines the position of active switch (defines position of first non-null value) and assigns 1,2,4 or 0 to "b" variable
Image

But after assigning "b" variable to be sent over OSC0, it doesn't go to Ableton:
Image

Why "b" variable changes are not sent to Ableton?
What am I doing wrong?
Last edited by Romang on 14 Jul 2012 06:43, edited 1 time in total.

shimoda
Regular
Posts:60
Joined:26 Mar 2012 19:25

Re: Variable not sent via OSC

Post by shimoda » 13 Jul 2012 21:51

What do you have to receive the OSC in Ableton?

Romang
Newbie
Posts:5
Joined:13 Jul 2012 17:55

Re: Variable not sent via OSC

Post by Romang » 14 Jul 2012 06:41

I have Max receiving all OSC messages:
Image

"print udp" shows all incoming messages on 8000 port except this "b" variable
I have tried to send variable to OSC1 and made one more port, but still the same - all other variables go into Max via OSC, except "b"


I did a monitor object to observe whether script "Quant" is doing all correct and it also shows the values which are being assigned to "b" variable:
Image

Why it still doesnt send "b" over OSC is a secret for me :)

Macciza
Regular
Posts:1325
Joined:07 Dec 2011 04:57
Location:Sydney, Australia.

Re: Variable not sent via OSC

Post by Macciza » 14 Jul 2012 06:51

Hi

Easy way to debug in Max is to drop a message box in and wire to the right input . . .

The message should be being sent as /Container5/Quant_switch/b which is what you need to route.
Or use the custom address to make it whatever you want.

Cheers
MM
iMac 2.8G i7 12G 10.6.8/10.7.2, Legacy Dexter/Lemur, Liine Lemur/iPad2, KMI SoftStep, 12Step & QuNeo , B-Controls, Mackie C4 etc
MaxMSP, Live Suite, Native Instrument stuff, etc Modified Virtual Guitar System etc All Projects/Modules © CC-BY-NC-SA[*][/b]

Romang
Newbie
Posts:5
Joined:13 Jul 2012 17:55

Re: Variable not sent via OSC

Post by Romang » 14 Jul 2012 07:33

Macciza wrote:Hi

Easy way to debug in Max is to drop a message box in and wire to the right input . . .

The message should be being sent as /Container5/Quant_switch/b which is what you need to route.
Or use the custom address to make it whatever you want.

Cheers
MM
I know debugging in Max, that's how I know this "Container5/Quant_switch/b" variable is not coming INTO MAX
I use "print udp" as I wrote earlier, which shows all incoming OSC messages which arrived.
So I think the error is somewhere in Lemur - the variable doesn't come from it.

Macciza
Regular
Posts:1325
Joined:07 Dec 2011 04:57
Location:Sydney, Australia.

Re: Variable not sent via OSC

Post by Macciza » 14 Jul 2012 10:25

Hi
Was just trying to point out that the OSC-route was not going to work because the address needs to be the full message.

Anyway will have to check but possibly because it is undefined it is not evaluated,
or because in the order of execution it has not been set yet - just a few thoughts of the top of my head.

So a solution? Make 'b' do something .
I split your script up a bit.
I created a container called _func which would contain various function.
I made an manual script called quant though the name could possibly be better
It take a number froom 0 to 3 and returns the numbers you want instead.

The 'b' expression now calls that function with the firstof(x) of the switch it is in
This then works top send the OSC message
Var_now_set.jzml
(2.69KiB)Downloaded 205 times
Cheers
MM
iMac 2.8G i7 12G 10.6.8/10.7.2, Legacy Dexter/Lemur, Liine Lemur/iPad2, KMI SoftStep, 12Step & QuNeo , B-Controls, Mackie C4 etc
MaxMSP, Live Suite, Native Instrument stuff, etc Modified Virtual Guitar System etc All Projects/Modules © CC-BY-NC-SA[*][/b]

axel_liine
Liine Staff
Posts:126
Joined:14 Dec 2011 12:12

Re: Variable not sent via OSC

Post by axel_liine » 14 Jul 2012 14:02

Romang wrote:
Macciza wrote:Hi

Easy way to debug in Max is to drop a message box in and wire to the right input . . .

The message should be being sent as /Container5/Quant_switch/b which is what you need to route.
Or use the custom address to make it whatever you want.

Cheers
MM
I know debugging in Max, that's how I know this "Container5/Quant_switch/b" variable is not coming INTO MAX
I use "print udp" as I wrote earlier, which shows all incoming OSC messages which arrived.
So I think the error is somewhere in Lemur - the variable doesn't come from it.
Indeed, variables whose values are changed by assigning in a script do not send out their new values by default.
You could send the OSC message within your script with oscout()
A workaround would be to set another variable in your script :

Code: Select all

if (a==0) b2 = 1;
else if (a==1) b2 = 2;
...
and set up the "b" variable to evaluate to "b2" (instead of leaving it blank). Then "b" will update to the value of "b2" anytime it is changed from a script, and output its new value via OSC.

Romang
Newbie
Posts:5
Joined:13 Jul 2012 17:55

Re: Variable not sent via OSC

Post by Romang » 16 Jul 2012 18:57

Macciza wrote:Hi
Was just trying to point out that the OSC-route was not going to work because the address needs to be the full message.

Anyway will have to check but possibly because it is undefined it is not evaluated,
or because in the order of execution it has not been set yet - just a few thoughts of the top of my head.

So a solution? Make 'b' do something .
I split your script up a bit.
I created a container called _func which would contain various function.
I made an manual script called quant though the name could possibly be better
It take a number froom 0 to 3 and returns the numbers you want instead.

The 'b' expression now calls that function with the firstof(x) of the switch it is in
This then works top send the OSC message
Var_now_set.jzml
Cheers
MM
Thank you!
I will try your Lemur interface!
I know about OSC-route, it was just a chunk of all my patch :)

Romang
Newbie
Posts:5
Joined:13 Jul 2012 17:55

Re: Variable not sent via OSC

Post by Romang » 16 Jul 2012 19:00

axel_liine wrote: Indeed, variables whose values are changed by assigning in a script do not send out their new values by default.
You could send the OSC message within your script with oscout()
YES! This works for my interface, thanks for pointing to such a great function!

axel_liine wrote:
A workaround would be to set another variable in your script :

Code: Select all

if (a==0) b2 = 1;
else if (a==1) b2 = 2;
...
and set up the "b" variable to evaluate to "b2" (instead of leaving it blank). Then "b" will update to the value of "b2" anytime it is changed from a script, and output its new value via OSC.

this method isn't working...

But big thanks for pointing to oscout!

Post Reply