Creating SynthDef with OSC messages

hello everybody,
I would like to know if it would be technically create a SynthDef by sending an OSC message rom another program and write a custom OSCFunc to do that.
thanks for your help.

If you want the other program to send a message to an OSCFunc in sclang, and the action function sends a SynthDef, yes, of course this is fine. (There’s no reason why this would be prohibited.)


1 Like

Sending the synthdef directly to the server is possible but incredibly complex (don’t).

Sending some variable information to an OSCdef to specialise a Synthdef (which is what jamshark70 suggested) is nice and simple - and what you should do…

…but you can take this one step further and execute any code through an OSCdef (although this is potentially really dangerous!)

OSCdef(\executor, {
	try { msg[1].asString.interpret.postln } 
	{ postf("could not execute msg: \n\t%\n", msg[2].asString) };
}, '/exec');

~n = NetAddr("localhost", 57120);

~n.sendMsg('/exec', "3 + 3");

s.waitForBoot {
	~n.sendMsg('/exec', "{ * 0.1 }.play")