Extending SuperCollider



As well as rich libraries of classes and UGens which come with SuperCollider, there are many third party extensions (examples, classes and UGens) which you can download from various places:


the swiki site

http://swiki.hfbk-hamburg.de:8888/MusicTechnology/6


the sc-plugins SourceForge project:

http://sourceforge.net/projects/sc3-plugins/



the Quarks repository (see [Quarks])


Various third party websites


Off the sc-users mailing list (archive via Google if you search with sc-users in the search line, or via the swiki site or Nabble archives)































The easiest way to install such packages is to put all help files, .sc class files and plugin files (like .scx, .sco and similar) into a platform specific Extensions directory.


On my Mac this is :


/Library/Application Support/SuperCollider/Extensions/


You can check where it is on your system with: 


Platform.userExtensionDir


Notwe that you may need to create a folder called 'Extensions' at the required location if you do not have one there already. 



Once you have put the new materials in your extensions folder, then startup SuperCollider or recompile SuperCollider if it is already open (cmd+K on a Mac 3.5 or earlier, cmd+shift+L 3.6). Now open any main help file for the library in SC, boot the server and try the examples. 


Most extensions should come with a readme file with instructions.














Customising SuperCollider


You may also wish to change the default options in SuperCollider. 


You might do this by modifying these classes:


ServerOptions 

Main


But it is much more straight forward to modify a platform specific startup file. 


On a Mac, this is located at:


"/Library/Application Support/SuperCollider/startup.sc"


(i.e. parallel to the Extensions directory)









To give an example of the sort of thing that can go in there, here is an extract from one of mine:

       

"Nick's Startup File".postln;    

     

//avoid Rendezvous, ServerOptions

Server.local.options.zeroConf = false;     

Server.internal.options.zeroConf = false;   

     

Server.local.options.numOutputBusChannels = 8;

Server.local.options.numInputBusChannels = 8;

Server.internal.options.numOutputBusChannels = 8;

Server.internal.options.numInputBusChannels = 8;

Server.local.options.memSize = 10*8192;  //so lots of memory for delay lines in Comb UGens etc

Server.internal.options.memSize = 10*8192;

Server.local.latency=0.045; //low latency is helpful for optimal performance for some machine listening processes

Server.internal.latency= 0.025;


//"SC_PLUGIN_PATH".setenv("/Volumes/data/sc3code/plugins/".standardizePath); // all defs in this directory will be loaded at startup

//"echo \"Loading Plugins From '$SC_PLUGIN_PATH'\"".unixCmd;


//~/scwork/synthdefs/

SynthDef.synthDefDir_("/Volumes/data/sc3code/synthdefs/".standardizePath);


//load on startup of server

"SC_SYNTHDEF_PATH".setenv("/Volumes/data/sc3code/synthdefs/".standardizePath); // all defs in this directory will be loaded at startup

"echo \"Loading SynthDefs From '$SC_SYNTHDEF_PATH'\"".unixCmd;

//Server.local.recSampleFormat_("int16"); //I sometimes might use this for standard wav file out as deafult, but currently accepting the float default

//Server.internal.recSampleFormat_("int16");

Server.local.recHeaderFormat_("wav");

Server.internal.recHeaderFormat_("wav");


//Server.local.options.device = "Test";

//Server.internal.options.device = "Test";

















It is also possible to overwrite existing methods of classes or add extra methods to classes, without modifying original source files: this is really helpful if you are frequently updating SuperCollider and don't want to have to change anything in a new download.



To hack my own Server window GUIs I made a class file of the form


+ Server {

makeWindow { arg w;

...

}

}


The + Server part means that this class file is adding extra methods to the Server class (which can be instance or class methods). If a method exists already, it can be overwritten- hence my suppressal of the standard Server GUI.


 




















Because SC3 is open source, it is even possible to compile SuperCollider yourself after modifying the server or language code. This, however, is not recommended for the faint hearted (see the Writing Primitives help file and sc-dev mailing list archives). The furthest you might go in normal practise is writing new plug-ins for the server (new UGens) which is carried out with C programming.