rsc3/doc-schelp/HelpSource/Reference/StartupFile.schelp

47 lines
2.1 KiB
Text

title:: Sclang Startup File
summary:: The sclang startup file
categories:: Language
Once the class library is finished compiling the interpreter looks for a file at code::Platform.userConfigDir +/+ "startup.scd":: and if such a
file exists, executes any code within it (this happens within link::Classes/Main#-startup::). By creating a file in this location you can make user
specific customizations.
definitionList::
## Linux || teletype::~/.config/SuperCollider/startup.scd::, according to the xdg base directory specification
## macOS || teletype::~/Library/Application Support/SuperCollider/startup.scd::
## Windows || teletype::C:\\SuperCollider\\startup.scd:: (or similar, depending on the location of the SuperCollider installation)
::
A common example would be to alter the options of the local and internal Servers:
code::
// placing the following code in the file will cause these modifications to be made
// at startup (see also: ServerOptions)
Server.local.options.numOutputBusChannels = 4; // change number of input and output channels
Server.local.options.numInputBusChannels = 4;
Server.internal.options.numOutputBusChannels = 4;
Server.internal.options.numInputBusChannels = 4;
Server.local.options.device = "Built-in Audio"; // use a specific soundcard
Server.local.options.device = "MOTU Traveler";
Server.local.options.device = "TASCAM US-122";
Server.local.options.device = "Jack Router";
Server.local.options.device = nil; // use the system default soundcard
Server.local.options.blockSize = 128; // increase block size (default is 64)
Server.internal.options.blockSize = 128;
Server.local.options.sampleRate = 96000; // increase sampling rate (if your hardware supports it)
Server.internal.options.sampleRate = 96000;
Server.internal.options.sampleRate = nil; // use the currently selected samplerate of the soundcard
// change the standard archive path to a custom one:
Archive.archiveDir = "~/scwork".standardizePath;
// hook up jack ports to audio channels
"SC_JACK_DEFAULT_INPUTS".setenv("system");
"SC_JACK_DEFAULT_OUTPUTS".setenv("system");
::
Naturally the file must contain only valid SC expressions.