Discussion:
Osc messages to proxy space problems
paganmuzak
2014-09-20 17:37:19 UTC
Permalink
Hi all,

I'm trying to send Osc messages from processing to an "audio" function of a
Proxy space.
The purpose is to make experiments in live coding, controlling certain
parameters by processing via Osc.
The code is this:

o = OSCFunc({ arg msg; ("o"++msg).postln; ~freq = msg[3]}, '/ID', nil, nil,
['0', 0, nil] );

p = ProxySpace.push();

~grano = {SinOsc.ar(~freq.midicps)}

~grano.play
~freq = 94;

and this is the Processing code:

import processing.net.*;
import themidibus.*;

import oscP5.*;
import netP5.*;
//import supercollider.*;

OscP5 oscP5, sendOscP5;
NetAddress myRemoteLocation;

MidiBus myBus;
int[] value = new int[15];

void setup() {
size(640,480);
oscP5 = new OscP5(this,57121);
myRemoteLocation = new NetAddress("127.0.0.1",57120);

myBus = new MidiBus(this, 1, 0);

}

void draw() {
if(mousePressed) {
value[0] = int((float)mouseX/width*127);
value[1] = int((float)mouseY/height*127);
OscMessage myMessage = new OscMessage("/ID");
myMessage.add("0");
myMessage.add(0);
myMessage.add(value[0]);
oscP5.send(myMessage, myRemoteLocation);
myMessage = new OscMessage("/ID");
myMessage.add("0");
myMessage.add(1);
myMessage.add(value[1]);
oscP5.send(myMessage, myRemoteLocation);
}
}



The system does not work well at all: by processing it is possible to vary
the frequency (freq ~) but in a incorrect way, the system becomes unstable
and finally the audio is silent.

Also, if you send a rapid sequence of commands Osc, for example by moving
the mouse with the button pressed, the following message appears on the
post:

*** ERROR: SynthDef temp__0freq_0 not found
FAILURE IN SERVER /s_new SynthDef not found
FAILURE IN SERVER /n_set Node 1084 not found
o[ /ID, 0, 0, 37 ]
o[ /ID, 0, 0, 38 ]
o[ /ID, 0, 0, 39 ]
o[ /ID, 0, 0, 40 ]
o[ /ID, 0, 0, 41 ]
*** ERROR: SynthDef temp__0freq_0 not found
FAILURE IN SERVER /s_new SynthDef not found
FAILURE IN SERVER /n_set Node 1089 not found
o[ /ID, 0, 0, 41 ]
o[ /ID, 0, 0, 42 ]
*** ERROR: SynthDef temp__0freq_0 not found
FAILURE IN SERVER /s_new SynthDef not found
FAILURE IN SERVER /n_set Node 1091 not found
o[ /ID, 0, 0, 42 ]

etc. etc.

Probably I did not understand very well the operation of the proxy space, in
particular with regard to the scope of the system variables and environment
variables.

I also wonder whether it would be a better solution, use the control bus,
instead of environment variables to change the frequency of the SinOsc

Thank you in advance who can give me a hand.
best Regards

Roberto



--
View this message in context: http://new-supercollider-mailing-lists-forums-use-these.2681727.n2.nabble.com/Osc-messages-to-proxy-space-problems-tp7613486.html
Sent from the SuperCollider Users New (Use this!!!!) mailing list archive at Nabble.com.

_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/
Stefan Nussbaumer
2014-09-20 21:51:54 UTC
Permalink
hi,

maybe have a look what's coming in over OSC from your processing sketch:

OSCFunc.trace(true);

... you're getting negative values for freq if your mouse is left or/and
above the left top corner position of your sketch on screen.

stefan

_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/
paganmuzak
2014-09-21 19:25:12 UTC
Permalink
Tank you very much Stefan,
I tried to check the values ​​received from the OscFunc and the problem also
occurs with positive values ​​in the m.i.d.i. range
Roberto




--
View this message in context: http://new-supercollider-mailing-lists-forums-use-these.2681727.n2.nabble.com/Osc-messages-to-proxy-space-problems-tp7613486p7613501.html
Sent from the SuperCollider Users New (Use this!!!!) mailing list archive at Nabble.com.

_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/
James Harkins
2014-09-21 03:55:22 UTC
Permalink
Post by paganmuzak
The system does not work well at all: by processing it is possible to vary
the frequency (freq ~) but in a incorrect way, the system becomes unstable
and finally the audio is silent.
This is a bug, or limitation, in the implementation of numbers as sources
for node proxies. It works if you don't change the number too often, but
very fast updates (as you get from GUI or external controls) break it.

Julian fixed this in a rewrite of several parts of JITLib. I think this
will go into the next major release. It's already in the development
version; if you're comfortable with building from source, you can get the
fix that way.

Otherwise, a control bus is a better solution for now.

hjh

Sent with AquaMail for Android
http://www.aqua-mail.com



_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/
paganmuzak
2014-09-21 19:30:31 UTC
Permalink
Tank you for the help,
So, i Will wait for the next release, and try to use busses for now.
Roberto



--
View this message in context: http://new-supercollider-mailing-lists-forums-use-these.2681727.n2.nabble.com/Osc-messages-to-proxy-space-problems-tp7613486p7613502.html
Sent from the SuperCollider Users New (Use this!!!!) mailing list archive at Nabble.com.

_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/
Stefan Nussbaumer
2014-09-21 20:34:02 UTC
Permalink
Post by paganmuzak
Tank you for the help,
So, i Will wait for the next release, and try to use busses for now.
Don't know if it suits your demands but you could as well just create an
arg named 'freq' for your ~grano:

~grano = { |freq| SinOsc.ar(freq.midicps) }

... and set freq just like you would do for a running synth

~grano.set(\freq, ...)

in your OSCFunc. But I guess a control bus would be more flexible...

stefan

_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/
paganmuzak
2014-09-22 05:49:54 UTC
Permalink
I thank you for this additional cue. I will try to use both solutions
Roberto



--
View this message in context: http://new-supercollider-mailing-lists-forums-use-these.2681727.n2.nabble.com/Osc-messages-to-proxy-space-problems-tp7613486p7613511.html
Sent from the SuperCollider Users New (Use this!!!!) mailing list archive at Nabble.com.

_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/
paganmuzak
2014-09-22 07:08:21 UTC
Permalink
I have yet to try the solution that uses the bus, but I already try with your
solution (the set) and it works fine
thanks
Roberto



--
View this message in context: http://new-supercollider-mailing-lists-forums-use-these.2681727.n2.nabble.com/Osc-messages-to-proxy-space-problems-tp7613486p7613512.html
Sent from the SuperCollider Users New (Use this!!!!) mailing list archive at Nabble.com.

_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/
paganmuzak
2014-09-23 09:01:55 UTC
Permalink
On September 21, 2014 1:37:49 AM paganmuzak <
Post by paganmuzak
The system does not work well at all: by processing it is possible to vary
the frequency (freq ~) but in a incorrect way, the system becomes unstable
and finally the audio is silent.
This is a bug, or limitation, in the implementation of numbers as sources
for node proxies. It works if you don't change the number too often, but
very fast updates (as you get from GUI or external controls) break it.
Julian fixed this in a rewrite of several parts of JITLib. I think this
will go into the next major release. It's already in the development
version; if you're comfortable with building from source, you can get the
fix that way.
Otherwise, a control bus is a better solution for now.
hjh
Sent with AquaMail for Android
http://www.aqua-mail.com
_______________________________________________
sc-users mailing list
http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/
I still need a little help.
I tried to use a bus in this way:

c = Bus.control(s, 24);
o = OSCFunc({ arg msg;
(msg[2].value.asString++":"++msg[3].value.asString).postln; c.setAt(msg[2],
msg[3].value)}, '/ID', nil, nil, ['0', nil, nil] );
p = ProxySpace.push();
~grano = { |freq = 0.5| SinOsc.ar(freq*1000) };
~grano.play;
~grano.map(\freq, c.index);

but I get the following error when evaluate the last line of code
(~grano.map(\freq, c.index);):

ERROR: map: not a node proxy
CALL STACK:
Exception:reportError 0x44e3830
arg this = <instance of Error>
Nil:handleError 0x453e710
arg this = nil
arg error = <instance of Error>
Thread:handleError 0x44e1250
arg this = <instance of Thread>
arg error = <instance of Error>
Object:throw 0x452d010
arg this = <instance of Error>
< FunctionDef in Method ProxyNodeMap:map > 0x54f1cb0
arg key = 'freq'
arg mapProxy = 0
var setting = nil
var numChannels = nil
Integer:forBy 0x54f0770
arg this = 0
arg endval = 0
arg stepval = 2
arg function = <instance of Function>
var i = 0
var j = 0
SequenceableCollection:pairsDo 0x54a8550
arg this = [*2]
arg function = <instance of Function>
ProxyNodeMap:map 0x5d38810
arg this = <instance of ProxyNodeMap>
arg args = [*2]
var playing = true
NodeProxy:map 0x55fc130
arg this = <instance of NodeProxy>
arg args = [*2]
var bundle = <instance of List>
Interpreter:interpretPrintCmdLine 0x44ab350
arg this = <instance of Interpreter>
var res = nil
var func = <instance of Function>
var code = "~grano.map(\freq, c.index);"
var doc = nil
var ideClass = <instance of Meta_ScIDE>
Process:interpretPrintCmdLine 0x5d30770
arg this = <instance of Main>
^^ The preceding error dump is for ERROR: map: not a node proxy




--
View this message in context: http://new-supercollider-mailing-lists-forums-use-these.2681727.n2.nabble.com/Osc-messages-to-proxy-space-problems-tp7613486p7613531.html
Sent from the SuperCollider Users New (Use this!!!!) mailing list archive at Nabble.com.

_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/
nescivi
2014-10-03 12:12:07 UTC
Permalink
.map in ProxySpace expects another proxy, not a bus.

sincerely,
Marije
Post by paganmuzak
On September 21, 2014 1:37:49 AM paganmuzak &lt;
Post by paganmuzak
The system does not work well at all: by processing it is possible to vary
the frequency (freq ~) but in a incorrect way, the system becomes unstable
and finally the audio is silent.
This is a bug, or limitation, in the implementation of numbers as sources
for node proxies. It works if you don't change the number too often, but
very fast updates (as you get from GUI or external controls) break it.
Julian fixed this in a rewrite of several parts of JITLib. I think this
will go into the next major release. It's already in the development
version; if you're comfortable with building from source, you can get the
fix that way.
Otherwise, a control bus is a better solution for now.
hjh
Sent with AquaMail for Android
http://www.aqua-mail.com
_______________________________________________
sc-users mailing list
http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/
I still need a little help.
c = Bus.control(s, 24);
o = OSCFunc({ arg msg;
(msg[2].value.asString++":"++msg[3].value.asString).postln; c.setAt(msg[2],
msg[3].value)}, '/ID', nil, nil, ['0', nil, nil] );
p = ProxySpace.push();
~grano = { |freq = 0.5| SinOsc.ar(freq*1000) };
~grano.play;
~grano.map(\freq, c.index);
but I get the following error when evaluate the last line of code
ERROR: map: not a node proxy
Exception:reportError 0x44e3830
arg this = <instance of Error>
Nil:handleError 0x453e710
arg this = nil
arg error = <instance of Error>
Thread:handleError 0x44e1250
arg this = <instance of Thread>
arg error = <instance of Error>
Object:throw 0x452d010
arg this = <instance of Error>
< FunctionDef in Method ProxyNodeMap:map > 0x54f1cb0
arg key = 'freq'
arg mapProxy = 0
var setting = nil
var numChannels = nil
Integer:forBy 0x54f0770
arg this = 0
arg endval = 0
arg stepval = 2
arg function = <instance of Function>
var i = 0
var j = 0
SequenceableCollection:pairsDo 0x54a8550
arg this = [*2]
arg function = <instance of Function>
ProxyNodeMap:map 0x5d38810
arg this = <instance of ProxyNodeMap>
arg args = [*2]
var playing = true
NodeProxy:map 0x55fc130
arg this = <instance of NodeProxy>
arg args = [*2]
var bundle = <instance of List>
Interpreter:interpretPrintCmdLine 0x44ab350
arg this = <instance of Interpreter>
var res = nil
var func = <instance of Function>
var code = "~grano.map(\freq, c.index);"
var doc = nil
var ideClass = <instance of Meta_ScIDE>
Process:interpretPrintCmdLine 0x5d30770
arg this = <instance of Main>
^^ The preceding error dump is for ERROR: map: not a node proxy
--
View this message in context: http://new-supercollider-mailing-lists-forums-use-these.2681727.n2.nabble.com/Osc-messages-to-proxy-space-problems-tp7613486p7613531.html
Sent from the SuperCollider Users New (Use this!!!!) mailing list archive at Nabble.com.
_______________________________________________
sc-users mailing list
info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/
_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/
Julian Rohrhuber
2014-10-04 20:55:33 UTC
Permalink
Post by nescivi
.map in ProxySpace expects another proxy, not a bus.
In general, in the newer versions of SC (3.7) allows all objects that respond to asOSCArgArray or asControlInput, such as Bus, Buffer, Synth, Function etc. But set and map are the same now, so this returns a bus index for Bus, so you'll have to write Bus.asMap here, if you want to map.
_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/

Loading...