SuperCollider: drawing UGen graph

Many people find it useful to see graphically the network of unit generators in their SynthDefs. There is a Quark that will create a Graphviz .dot file from your SuperCollider code.

First, install Graphviz (of course). There are downloads for OSX, Linux, and others.

Then you need to install the rd_dot Quark. If you’ve never dealt with Quarks before, it is rather simple to install them. In your SuperCollider interpreter, type this:

You will get a GUI window of all the available Quarks. The first time you run this the list will probably be empty. Press the Update Quark Listing button. Depending on your security settings, you may be prompted to accept their certificate. There will be a local listing written to your ~/Library/Application Support/SuperCollider/quarks directory. You might not get the listing refreshed immediately in your GUI windows after the process is finished. Simple kill the GUI and start it again.

Then, find the rd_dot quark. Click on the icon to the left of the name so it now reads +. Now press the Apply button in the “toolbar”. The rd_dot quark will be installed in your quarks directory.

Recompile your class library. It’s on the Language menu. Rebooting the interpreter will do it.

Try it out by changing the play method in your hacks to draw. Here’s a simple sine wave:

Change play to draw:

When you interpret this now, you will get this displayed in Graphviz:

UGen graph

Possible glitch

If you have Word installed (I had a shotgun aimed at me), the file will open in Word since .dot files are associated with Word. The rd_dot quark writes a Graphviz .dot file to your tmp directory. An easy way to fix the association is to open any .dot file in the Finder inspector. Select it in Finder and press cmd-I. One of the sections in the inspector is Open With. Select SuperCollider from the option menu and apply to all.

If you want Word to remain associated with .dot files, you’ll have to hack the rd_dot code. It uses a simple call to open without any parameters, which is why Word is used. Change the open call to

One Reply to “SuperCollider: drawing UGen graph”

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.