Supercollider Cheat Sheets

Nov 26 2022 · LastMod: Nov 26 2022

Quick Reference

1s.boot;
2FreqScope.new;
3Stethoscope.new;

Connecting to IanniX via OSC

  1. Run NetAddr.localAddr in sclang. The printed message would be something like NetAddr(127.0.0.1, 57120).
  2. In IanniX, inspector -> config -> Network. Change the port to, e.g., 57120.

To check whether the connection is working, run OSCFunc.trace(true,true) in sclang. Make a cursor in IanniX and play, see if there are any OSC messages printed.

Create a cursor object in IanniX and play it, in config -> message lines will be printed in the form of

100:00:11:466 : osc://127.0.0.1:57120/cursor	2		0.8434560298919678	0.2949684262275696	0.5	1.6178126335144043	-0.9992097616195679	0

Now an OSC response function can be defined with OSCdef.new, e.g.

 1(
 2OSCdef.new(
 3        \cursor_message,
 4        {
 5                arg msg, time, addr, port;
 6                [msg,time,addr,port].postln;
 7        },
 8        '/cursor'
 9);
10)

Run the code in sclang and run IanniX, OSC responses will be printed in the post window.

A quick example:

 1Ndef( \sounds, { SinOsc.ar([\lfreq.kr(300),\rfreq.kr(301)], 0, 0.3) } );
 2
 3(
 4OSCdef.new(
 5	\shift,
 6	{
 7		arg msg;
 8		Ndef( \sounds ).set( \lfreq, ([275, 325, \lin].asSpec.map( msg[3] )) );
 9               Ndef( \sounds ).set( \rfreq, ([275, 325, \lin].asSpec.map( msg[4] )) );
10	},
11	'/cursor'
12);
13)

Draw a circular curve in IanniX and run.