paganmuzak
2014-09-20 17:37:19 UTC
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/
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/