Go Back   Cockos Incorporated Forums > REAPER Forums > REAPER Q&A, Tips, Tricks and Howto

Reply
 
Thread Tools Display Modes
Old 11-05-2020, 03:23 AM   #1
buscon
Human being with feelings
 
Join Date: Dec 2018
Posts: 10
Default Send OSC to another program (Supercollider)

hi,

I would like to send a control OSC data to Supercollider.
I would basically like to send the automation that I draw in a track in Reaper to Supercollider.
For now I added a control surface in reaper, with the IP and Port of the receiver (Supercollider).

I am an expert user of Supercollider and OSC data, I do not fully understand how can I send such data from Reaper to an external program.
buscon is offline   Reply With Quote
Old 12-02-2020, 06:36 AM   #2
wadewatts
Human being with feelings
 
Join Date: Nov 2020
Location: depends
Posts: 23
Default

hey buscon!

it's actually fairly easy let met explain:

assuming it's all set up on both sides (with NetAddr running in SC).

create a new track in reaper, put a dummy JS plugin with just sliders
or just create a new JS plugin and paste this:

Code:
desc: 16 parameters

slider1:0<0,100,0.125>p1
slider2:0<0,100,0.125>p2
slider3:0<0,100,0.125>p3
slider4:0<0,100,0.125>p4
slider5:0<0,100,0.125>p5
slider6:0<0,100,0.125>p6
slider7:0<0,100,0.125>p7
slider8:0<0,100,0.125>p8
slider9:0<0,100,0.125>p9
slider10:0<0,100,0.125>p10
slider11:0<0,100,0.125>p11
slider12:0<0,100,0.125>p12
slider13:0<0,100,0.125>p13
slider14:0<0,100,0.125>p14
slider15:0<0,100,0.125>p15
slider16:0<0,100,0.125>p16

now in SC, you've to have a OSCDef for each parameter.

you can use my code as example, you just have to sort the ins and outs depending on your config + it uses StageLimiter which you can remove.

Code:
(
~audioIns=ServerOptions.inDevices;
~audioOuts=ServerOptions.outDevices;
~port=57120;
~addr="127.0.0.1";

s.options.inDevice_(~audioIns[2]);
s.options.outDevice_(~audioOuts[2]);
s.options.numInputBusChannels_(0); // 0 or 32
s.options.numOutputBusChannels_(2);
n=NetAddr(~addr, ~port);
MIDIIn.connectAll;
s.meter;
StageLimiter.activate;

s.waitForBoot(
	(

		~sc_track = 6; // TRACK # IN REAPER

		~cBus1 = Bus.control(s,1);
		~cBus2 = Bus.control(s,1);
		~cBus3 = Bus.control(s,1);
		~cBus4 = Bus.control(s,1);
		~cBus5 = Bus.control(s,1);
		~cBus6 = Bus.control(s,1);
		~cBus7 = Bus.control(s,1);
		~cBus8 = Bus.control(s,1);
		~cBus9 = Bus.control(s,1);
		~cBus10 = Bus.control(s,1);
		~cBus11 = Bus.control(s,1);
		~cBus12 = Bus.control(s,1);
		~cBus13 = Bus.control(s,1);
		~cBus14 = Bus.control(s,1);
		~cBus15 = Bus.control(s,1);
		~cBus16 = Bus.control(s,1);

		MIDIdef.noteOn(\notein,{|vel note|
			{
				var frq = In.kr(~cBus1);
				var hrm = In.kr(~cBus2);
				var att = In.kr(~cBus3);
				var rel = In.kr(~cBus4);
				var mfq = In.kr(~cBus5);
				var mod = In.kr(~cBus6);
				var fm = SinOsc.ar(note.midicps+(mfq*1000),0,mod*100);
				var sig = Blip.ar(note.midicps+fm*(frq*100)+1.0.xrand2,hrm*16*(vel/127));
				var env = EnvGen.kr(Env.perc(att,rel*2),doneAction:2);
				sig = sig*env;
				Out.ar(0,sig!2);
			}.play;
		});


		OSCdef.new(\p1,{|val|~cBus1.set(val[1])},"/track/"++~sc_track++"/fx/1/fxparam/1/value");
		OSCdef.new(\p2,{|val|~cBus2.set(val[1])},"/track/"++~sc_track++"/fx/1/fxparam/2/value");
		OSCdef.new(\p3,{|val|~cBus3.set(val[1])},"/track/"++~sc_track++"/fx/1/fxparam/3/value");
		OSCdef.new(\p4,{|val|~cBus4.set(val[1])},"/track/"++~sc_track++"/fx/1/fxparam/4/value");
		OSCdef.new(\p5,{|val|~cBus5.set(val[1])},"/track/"++~sc_track++"/fx/1/fxparam/5/value");
		OSCdef.new(\p6,{|val|~cBus6.set(val[1])},"/track/"++~sc_track++"/fx/1/fxparam/6/value");
		OSCdef.new(\p7,{|val|~cBus7.set(val[1])},"/track/"++~sc_track++"/fx/1/fxparam/7/value");
		OSCdef.new(\p8,{|val|~cBus8.set(val[1])},"/track/"++~sc_track++"/fx/1/fxparam/8/value");
		OSCdef.new(\p9,{|val|~cBus9.set(val[1])},"/track/"++~sc_track++"/fx/1/fxparam/9/value");
		OSCdef.new(\p10,{|val|~cBus10.set(val[1])},"/track/"++~sc_track++"/fx/1/fxparam/10/value");
		OSCdef.new(\p11,{|val|~cBus11.set(val[1])},"/track/"++~sc_track++"/fx/1/fxparam/11/value");
		OSCdef.new(\p12,{|val|~cBus12.set(val[1])},"/track/"++~sc_track++"/fx/1/fxparam/12/value");
		OSCdef.new(\p13,{|val|~cBus13.set(val[1])},"/track/"++~sc_track++"/fx/1/fxparam/13/value");
		OSCdef.new(\p14,{|val|~cBus14.set(val[1])},"/track/"++~sc_track++"/fx/1/fxparam/14/value");
		OSCdef.new(\p15,{|val|~cBus15.set(val[1])},"/track/"++~sc_track++"/fx/1/fxparam/15/value");
		OSCdef.new(\p16,{|val|~cBus16.set(val[1])},"/track/"++~sc_track++"/fx/1/fxparam/16/value");
	)
)
)
now you can play and automate the params in Reaper (and change their name to mirror their use in SC.

hope this helped

PS: i advise you always just send MIDI gates, notes and velocities to trigger SC, it's much more convenient than doing it with OSC.

Last edited by wadewatts; 12-02-2020 at 07:23 AM. Reason: post scriptum
wadewatts is offline   Reply With Quote
Old 12-02-2020, 07:30 AM   #3
wadewatts
Human being with feelings
 
Join Date: Nov 2020
Location: depends
Posts: 23
Default

ahhh and make sure to check the Default.ReaperOSC file in Reaper's OSC folder because it lists in/outgoing messages from/to Reaper.
wadewatts is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 06:14 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.