View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide

Running sclang

Home   How To   Code Pool   Public Library   Theory   Events

Command Line Options


for a list of command line options supported by sclang, execute
$ sclang -h


Runtime directory structure


sclang expects a runtime directory containing default directories where synthdefs are written to and sound files can be found.
Currently, these are:
 sounds/
 synthdefs/

On OSX the runtime directory is the build/ directory in the distribution, where the executable is copied to and started from.

on linux you can set the runtime directory with the -d command line option. sclang simply chdir's to the given argument before starting up. If you do not specify a directory on the command line, it defaults to the current directory, so if you start sclang in $HOME, you must create the directories synthdefs/, sounds/ etc. in $HOME.

When you start a server from sclang, it inherits its current directory from the parent process (sclang) and thus finds what it needs in synthdefs/ and sounds/, provided they exist.

Startup File


By default the file ~/.sclang.sc is sourced and executed on language startup. This is where you can customize settings like class variables, environment variables etc. Here's an example:

// set up Server to use a different executable
Server.program = "/usr/local/music/bin/scsynth";

// same for Score
Score.program = Server.program;

// set some server options for a different setup
#[\internal, \local].do { |s|
        s = Server.perform(s);
        s.options.numInputBusChannels = 2;
        s.options.numOutputBusChannels = 5;
};

// hook up jack ports to audio channels
"SC_JACK_DEFAULT_INPUTS".setenv(
        "alsa_pcm:capture_1,"
        "alsa_pcm:capture_2"
);
"SC_JACK_DEFAULT_OUTPUTS".setenv(
        "alsa_pcm:playback_1,"
        "alsa_pcm:playback_2,"
        "alsa_pcm:playback_3,"
        "alsa_pcm:playback_4,"
        "alsa_pcm:playback_5"
);


Note for Interface Developers


if you want to interface to sclang from an external application without linking to libsclang or using OSC, you can pipe commands to the terminal application through stdin. everything received is collected in a buffer until one of two special 'tokens' appears in the input:


Links to this Page