How to plot a SynthDef?


I just recently resumed my attempts at learning SuperCollider, and I am trying to make the leap from playing functions directly to using SynthDefs. There seems to be one critically important ability (for a learner at least) that I seem to have lost while making this leap: the ability to See What I Compute.

How do I graph the output of a Synth created from a SynthDef?


There are two or three ways you can introspect the output or internal state of a Synth - the most easy and straightforward is to use the poll method:

SynthDef(\foo, {
	var lfo =;
	lfo.poll(1, "lfo");

I built a slightly more accessible tool to graph control values of a Synth - you’re welcome to try it out. I’ve been working on a bigger SynthDef introspection library to solve exactly this problem in a much more open-ended and automatic way, but that’s a long way off from being complete…

(You’ll need to include this or add it to and extension folder)

Example (you can reset min and max values by clicking on them):

~bus = Bus.control(s, 1);
SynthDef(\foo, {
   var cutoff, sig;
   sig =;
   cutoff =, 400);, cutoff);
   sig =, cutoff);



You can also use get.

From the Synth help file:

SynthDef("help-Synth-get", { | out, freq = 440|,, 0, 0.1));
x = Synth("help-Synth-get");
x.set(\freq, 220 + 440.rand);
x.get(\freq, { arg value; ("freq is now:" + value + "Hz").postln; });;


BTW the reason why we can have { ... }.plot but not SynthDef(...).plot is:

  • When plotting a function, we can assume that the function’s return value (which is a network of UGen connections) is the signal that you want to plot.

  • If it’s a SynthDef, there is no guaranteed, reliable way to know what signal to plot. SynthDefs use to write the signal to a bus. To plot, we would need to know which bus. There is a loose convention that SynthDefs should have an out argument for the output bus number. But if the user said outbus or bus or audioOutputBus, how would SynthDef:plot know this? (Worse, a lot of new users take a shortcut and write, ...) in which case it would be impossible for a hypothetical SynthDef:plot method to isolate the signal from other things playing at the same time.)

poll is one workaround.

Another is to write a RecordBuf into the SynthDef (temporarily, delete it later), then plot the buffer’s contents.


b = Buffer.alloc(s, 44100, 1);

// hack the default synthdef
SynthDef(\default, { arg out = 0, freq = 440, amp = 0.1, pan = 0, gate = 1;
	var z;
	z = + [0, Rand(-0.4, 0.0), Rand(0.0, 0.4)], 0, 0.3, 0.3)),, 5000), Rand(2500, 3200), 1)
	) *, 0.01, 0.7, 0.3, 2);, b, loop: 0, doneAction: 2);  // <<-- inserted,, pan, amp));
}, [\ir]).add;

a = Synth(\default);  // will stop by itself


b.getToFloatArray(wait: -1, timeout: 5, action: { |data| d = data; "done".postln });