UGens OSC 57120

Hi, how to send SendReply, SendTrig or SendPeakRMS UGens on another OSC channel than 57120 ? For now i made a ‘bridge’ :

(
{SendTrig.kr(Impulse.kr(1), 0, 0)}.play;
OSCdef(\bridge, {|msg| 
	NetAddr("127.0.0.1", 1234).sendMsg('/anotherApp', msg[2]);
}, '/tr');
)

Is there a better/direct way ?
d

Your method is fine. Not sure if there is a better way. However, I would make the NetAddr outside the OSCdef, so you aren’t making a new one every time you get a trigger:

(
n= NetAddr("127.0.0.1", 57120);

{SendTrig.kr(Impulse.kr(1), 0, 0)}.play;
OSCdef(\bridge, {|msg| 
	n.sendMsg('/anotherApp', msg[2]);
}, '/tr');
)

There’s also the /notify server command, c.f.

https://doc.sccode.org/Reference/Server-Command-Reference.html#/notify

BTW 57120 is the default sclang port. If you are trying to send the message to another app, you probably want to use a different port in your NetAddr (and the other app).

use a different port in your NetAddr

exact, this is a mistake, i change it in the original post

Is there a better/direct way ?

I think you can send a ‘/notify’ OSC command from the other application. See Server Command Reference and Server.notify, I don’t remember much of it right now.

[EDIT] Just saw, it was mentioned by rdd above. I think that would be the more direct way.