jildertviet / ofxJVisuals

Personal project for generating realtime visuals.
Other
4 stars 0 forks source link

SuperCollider client #4

Closed jildertviet closed 1 year ago

jildertviet commented 2 years ago

Is it possible to add a UDP socket that sets up a SC client?

If so, then SendReply.kr might be nice to map oscillators to values of Events.

jildertviet commented 2 years ago

Tested: ofxUDPManager is bi-directional. I thought it wasn't, perhaps it has changed. To do: get OSC dump from SC when setting up a remote server.

jildertviet commented 2 years ago

Try ofxOscBidrectional Edit: works. It receives OSC send with SendReply.kr (SC)

jildertviet commented 2 years ago

Initial idea for mapping SC UGens to ofxJVisuals Events: Create Event in SC. Create a modulating synth on the server. Object.createMod() --> Create a Bus and a Synth that sends OSC w/ SendReply. {SendReply.kr(Impulse.kr(30), '/cmdName', [parameterID, In.kr(this.bus)], this.id)}.play

How to know which parameter to map? Something like: Object.createMod("brightness", [0, 255]); // Name + range Give a map to each UGen, "brightness" -> 0, "speed" -> 1, etc Then modulate with: x = {var dest = Object.bus("brightness"); Out.kr(dest.bus, LFPulse.kr(1).range(dest.range))}.play;

jildertviet commented 1 year ago

2022 update. The add-on starts an own SC server. (I think the previous example works with the default server of sclang). New goal is to have the server run on the same machine as OF.

How would mapping go?

  1. Create an event via sclang / scide.
  2. Create a modulator (synth). This can happen from sclang, with a Server.remote
  3. Each event has mappable parameters 0: "height", &height. (/mapVal, eventID, parameterID)
jildertviet commented 1 year ago

Example to show current implementation

~of = Server.remote(\of, NetAddr("localhost", 9999));

(
j = JRectangle.new();
j.create();

j.startBundle; // Make sure they're send at the same time
j.setLoc([100, 800]);
j.setSize([100, 100]);
j.setFilled(false);
j.endBundle;
j.mod("width", {SinOsc.kr(1).range(100, 200)});
)

Multiple versions of the code above resulted in: test