SuperCollider

SuperCollider Class design

Handy SuperCollider Tips!

Here are some tips that took me a long time to find out about and usually by accident. They will probably save you lots and lots of time when your starting out with SC.

.ar and .kr

Most UGens have 2 creation functions .ar and .kr

.ar
Audio rate. Much more accurate/high-bandwidth signal but bigger CPU cost
.kr
Control rate. Useful for control signals but less dense signal and hence less CPU usage.

Both can be used to make sound but if your using a UGen to modulate the inputs to another (apart from signal in) you want .kr

How to search the help

  1. Cmd + Shift + D to bring up the GUI help
  2. Notice the search bar in the bottom right. Type a word in there and press enter. This is a fairly limited search, i.e. you can only search for exact phrases, but it is case insensitive.

Given the lack of structure in the documentation or coherent overview this really made a big difference to my learning speed. You still have to figure out what to search for (eg. if your looking for 'sampling; you want to search for 'buffer'. There really needs to be a glossary to help musicians out with this).

Debugging

There are a few basics to debugging in SC. How to read the big nasty error messages is important. Basically you start at the bottom and read upwards. If its a short error message then its usually a syntax error and your missing a semi-colin ';' somewhere before where the error messages says its occurring.

Language side

.post
.postln
print out the value to the post window
.postcs
post the compileString which shows you the classes of the object you post

Server side

.poll

Adding .poll to a UGen will send back a stream of values to the post window.

{ SinOsc.ar(220).poll }.play

Handy shortcuts

Cmd + Shift + c
Clear the post window
Cmd + \
Bring post window forward
Cmd + d
General help
Cmd + Shift + d
Help GUI (with search!)
[highlight word] + Cmd + d
Look up that word directly in the help
[highlight UGen] + Cmd + y
Open the code for that UGen/function