10 Extending SuperCollider

download 10 Extending SuperCollider

If you can't read please download the document

description

SC Tutor

Transcript of 10 Extending SuperCollider

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 sitehttp://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 the platform specific Extensions directory.

on my Mac this is :

/Library/Application Support/SuperCollider/Extensions/

Then startup SuperCollider or recompile SuperCollider if it is already open (cmd+K on a Mac). Now open any main help file for the library in SC, boot the server and try the examples.

(otherwise you will need to put classes in SCClassLibrary, plugin files in the plugins directory and the help files in Help, within the main SuperCollider directory folder)

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.rtf"

(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 mine: "Nick's Startup File".postln; //avoid Rendezvous, ServerOptionsServer.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 etcServer.internal.options.memSize = 10*8192;Server.local.latency=0.045; //low latency is helpful for optimal performance for some machine listening processesServer.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";//for general use I also use symbolic links (ln -s path) from /Library/Application Support/SuperCollider/Extensions to my own class folder and help folder directories//Document.initAction_({//arg doc;////doc.background_(Color.black);//doc.stringColor_(Color.white);////});

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.

There is one new fun trick on Mac post version 3.3. This is the CocoaMenuItem class, which allows you to add your own items to the menu bar!