Classes | Server>Abstractions

# Server : Object

Object representing a server application
Source: Server.sc
Subclasses: SSHServer, ScoreStreamPlayer
See also: Server Guide, Multi-client Setups, ServerOptions, Server Architecture, Server Command Reference, ServerStatusWatcher, Audio device selection

## Description

A Server object is a representation of a server application. It is used to control scsynth (or supernova) from the SuperCollider language. (See Server Guide, as well as Client vs Server for more details on the distinction.) It forwards OSC messages and has a number of allocators that keep track of IDs for nodes, buses, and buffers.

The server application represented by a Server object might be running on the same machine as the sclang, or it may be running on a remote machine.

Most of a Server's options are controlled through its instance of ServerOptions. See the ServerOptions helpfile for more detail.

A server also holds an instance of a Recorder (for recording output into a file) and a Volume (main output level).

NOTE: By default, there is always one default server, which is stored in the interpreter variable 's'. E.g. you can boot the default server by calling `s.boot`
s.boot; { SinOsc.ar * 0.1 }.play(s); // play a synth on the server

The server application may be in three different states: running, not running, or unresponsive (for example while loading large files from disk).s.serverRunning // returns true if it is true

Some insights about common Server issues can be found on the FAQ Server Issues

## Class Methods

### Server.new(name, addr, options, clientID)

Create a new Server instance.

#### Arguments:

name | a symbol; each Server object is stored in one global classvariable under its name.
addr | an optional instance of NetAddr, providing host and port. The default is the localhost address using port 57110; the same as the local server.
options | an optional instance of ServerOptions. If `nil`, an instance of ServerOptions will be created, using the default values.
clientID | an integer. In multi-client situations, every client can be given separate ranges for Nodes, Buffers, or Busses. In normal usage, the server will supply an ID automatically when a client registers for the notifications so you should not need to supply one here. N.B. In multi-client situations, you will need to set the ServerOptions: -maxLogins to at least the number of clients you wish to allow. This must be the same in the Server instances on every client.

### Server.remote(name, addr, options, clientID)

Create a new Server instance corresponding to a server app running on a separate machine. This method assumes the remote app has been booted and starts listening immediately. You should not call -boot on an instance created using this method. Server Guide and Multi-client Setups contain further information on this and multiclient usage.

#### Arguments:

name | a symbol; each Server object is stored in one global classvariable under its name.
addr | an optional instance of NetAddr, providing IP address of the remote machine and port the app is listening on.
options | an optional instance of ServerOptions. If `nil`, an instance of ServerOptions will be created, using the default values. NOTE: To enable remote connections you will need to change the option ServerOptions: -bindAddress as the default value only allows connections from the local machine. `s.options.bindAddress = "0.0.0.0"` will allow connections from any address.
clientID | an integer. In multi-client situations, every client can be given separate ranges for Nodes, Buffers, or Busses. In normal usage, the server will supply an ID automatically when a client registers for the notifications so you should not need to supply one here. N.B. In multi-client situations, you will need to set the ServerOptions: -maxLogins to at least the number of clients you wish to allow. This must be the same in the Server instances on every client.// example usage: // on machine running the server ( s.options.bindAddress = "0.0.0.0"; // allow connections from any address s.options.maxLogins = 2; // set to correct number of clients s.boot; ) // on remote machine connecting to server ( o = ServerOptions.new; o.maxLogins = 2; t = Server.remote(\remote, NetAddr("192.168.0.130", 57110), o); // set to correct address and port // info about returned client ID should be posted in the post window t.makeWindow; // make a window for monitoring )

### Server.local

### Server.local = value

get/set the local server, stored in classvar `local` (created already on initClass)

### Server.internal

### Server.internal = value

get/set the internal server, stored in classvar `internal` (created already on initClass) See: Server Guide

### Server.default

### Server.default = server

Get or set the default server. By default this is the local server (see above).

#### Discussion:

Setting this will also assign it to the Interpreter variable 's'.// set the internal Server to be the default Server Server.default = Server.internal; s.postln; // internal

### Accessing all servers

### Server.all

### Server.all = value

#### Returns:

a Set containing all servers.Server.all

### Server.allRunningServers

#### Returns:

a Set containing all running servers, according to the definition of -serverRunning.Server.allRunningServers

### Server.allBootedServers

#### Returns:

a Set containing all booted servers, according to the definition of -hasBooted.

### Server.named

### Server.named = value

#### Returns:

An IdentityDictionary of all servers listed by their nameServer.named.at(\default)

### Server.quitAll(watchShutDown: true)

quit all registered servers

### Server.killAll

kill all the processes called "scsynth" and "supernova" in the system

### Server.freeAll(evenRemote: false)

free all nodes in all registered servers

### Server.hardFreeAll(evenRemote: false)

try to free all nodes in all registered servers, even if the server seems not to be running

### Server.sync_s

### Server.sync_s = value

If kept true (default), when the default server is changed, also the interpreter variable s is changed.Server.default = Server(\alice, NetAddr("127.0.0.1", 57130)); s.postln; // see: it is alice.

### Switching the server application

### Server.supernova

Switches the server program to supernova. Check ParGroup how to make use of multicore hardware with the supernova server.

### Server.scsynth

Switches the server program to scsynth. This is the default server.

### Inherited class methods

### Undocumented class methods

### Server.bufferAllocClass

### Server.bufferAllocClass = value

### Server.busAllocClass

### Server.busAllocClass = value

### Server.defaultOptionsClass

### Server.defaultOptionsClass = value

### Server.freeAllRemote(includeLocal: true)

From extension in /Users/zzk/Library/Application Support/SuperCollider/downloaded-quarks/wslib/wslib-classes/Extensions/Server/extServer-freeAllRemote.sc

### Server.fromName(name)

### Server.nodeAllocClass

### Server.nodeAllocClass = value

### Server.program

### Server.program = value

### Server.resumeThreads

### Server.set

### Server.set = item

From extension in /Applications/SuperCollider.app/Contents/Resources/SCClassLibrary/deprecated/3.10/deprecated-3.10.sc

## Instance Methods

### .sendMsg( ... msg)

send an OSC-message to the server.

#### Discussion:

s.sendMsg("/s_new", "default", s.nextNodeID, 0, 1);

### .sendBundle(time ... msgs)

send an OSC-bundle to the server.

#### Discussion:

Since the network may have irregular performance, time allows for the bundle to be evaluated at a specified point in the future. Thus all messages are synchronous relative to each other, but delayed by a constant offset. If such a bundle arrives late, the server replies with a late message but still evaluates it.s.sendBundle(0.2, ["/s_new", "default", x = s.nextNodeID, 0, 1], ["/n_set", x, "freq", 500]);

### .sendRaw(rawArray)

### .listSendMsg(msg)

as sendMsg, but takes an array as argument.

### .listSendBundle(time, msgs)

as sendBundle, but takes an array as argument.

#### Discussion:

This allows you to collect messages in an array and then send them.s.listSendBundle(0.2, [["/s_new", "default", x = s.nextNodeID, 0, 1], ["/n_set", x, "freq", 600]]);

### .sendSynthDef(name, dir)

send a synthDef to the server that was written in a local directory

### .loadSynthDef(name, completionMsg, dir)

load a synthDef that resides in the remote directory

### .loadDirectory(dir, completionMsg)

load all the SynthDefs in the directory dir.

#### Arguments:

dir | a String which is a valid path.
completionMsg |

### .nextNodeID

get a unique nodeID.

### .nextPermNodeID

get a permanent node ID. This node ID is in a reserved range and will be held until you explicitly free it.

### .freePermNodeID(id)

free a permanent node ID for later reuse.

### .wait(responseName)

this can be used within a Routine to wait for a server reply

### .waitForBoot(onComplete, limit: 100, onFailure)

Evaluate "onComplete" as soon as the server has booted. This method will boot the server for you if it is not already running or booting. If the server is already running, "onComplete" is executed immediately.

#### Arguments:

onComplete | A function to evaluate after the server has booted successfully.
limit | The number of times to check for a successful boot. (5 times/sec)
onFailure | A function to evaluate after the server fails to boot. If onFailure is not given, an error message is posted. Providing a function suppresses the error message. If you want to supply a function and print the normal error message, make sure that your function returns "false," e.g. `s.waitForBoot(onFailure: { ... custom action...; false })`.

### .doWhenBooted(onComplete, limit: 100, onFailure)

Evaluate "onComplete" as soon as the server has booted. This method assumes the server is being booted explicitly through a separate `boot` call. If the server is already running, "onComplete" is executed immediately.

#### Arguments:

onComplete | A function to evaluate after the server has booted successfully.
limit | The number of times to check for a successful boot.
onFailure | A function to evaluate after the server fails to boot. If onFailure is not given, an error message is posted. Providing a function suppresses the error message. If you want to supply a function and print the normal error message, make sure that your function returns "false," e.g. `s.doWhenBooted(onFailure: { ... custom action...; false })`.

### .boot(startAliveThread: true, recover: false, onFailure)

boot the remote server, create new allocators.

#### Arguments:

startAliveThread | If true, start a Routine to send a /status message to the server every so often. The interval between the messages is set by `theServer.aliveThreadPeriod = (seconds)`. The default period is 0.7. If false, /status will not be sent and the server's window will not update.
recover | If true, create a new node ID allocator for the server, but use the old buffer and bus allocators. This is useful if the server process did not actually stop. In normal use, the default value "false" should be used.
onFailure | In this method, the onFailure argument is for internal use only. If you wish to take specific actions when the server boots or fails to boot, it is recommended to use -waitForBoot or -doWhenBooted.

#### Discussion:

You cannot boot a server app on a remote machine, but you can initialize the allocators by calling this message.

### .quit(onComplete, onFailure, watchShutDown: true)

quit the server application

NOTE: If the server is unresponsive at the time of calling this method, it will be forced to quit immediately.

#### Arguments:

onComplete | A function that is called when quit has completed.
onFailure | A function that is called when quit has failed.
watchShutDown | a boolean to tell the server whether to watch status during shutdown.

### .reboot(func, onFailure)

quit and restart the server application

#### Arguments:

func | a function that is called between quit and (re-)boot.
onFailure | A function that is called when quit has failed.

### .freeAll

free all nodes in this server

### .status

query the server status

### .notify

### .notify = flag

The server sends notifications, for example, if a node was created, a 'tr' message from a SendTrig, or a /done action. If `flag` is set to false, these messages will not be sent to this client. The default is true. If true the server will respond with a clientID (scsynth only) which can be useful in multi-client situations. If this is different from any previously received ID new allocators will be created. See Local vs. Remote Servers, Multi-client Configurations for more information.

### .ping(n: 1, wait: 0.1, func)

measure the time between server and client, which may vary. the `func` is evaluated after `n` number of times and is passed the resulting maximum.

### .options

### .options = value

Get or set this Server's ServerOptions object. Changes to options only take effect when the server is rebooted.

### .defaultGroup

Return the default group on this Server for this client ID. This will be the same object as `server.defaultGroups[server.clientID]`.

### .defaultGroups

Return an array mapping client IDs to their associated default groups as Group objects.

### .volume

### .volume = newVolume

Get an instance of Volume that runs after the default group, or sets the Volume of the Server's output to level. Level is in db.

### .mute

mute the server's output. This can also be toggled from the Server window with the 'm' key.

### .unmute

unmute the server. This can also be toggled from the Server window with the 'm' key.

### .reorder(nodeList, target, addAction: 'addToHead')

Move the nodes in `nodeList` to the location specified by `target` and `addAction`, placing them there in the order indicated by nodeList.

#### Discussion:

Any nodes which have already been freed will be skipped. Passing nil for target and addAction will result in the location being the head of the default group.g = Group.new; x = Array.fill(5, {Synth(\default)}); s.queryAllNodes; s.reorder(x, g, \addToTail); s.queryAllNodes;

### .inputBus

Return a Bus object that represents the input audio bus.

### .outputBus

Return a Bus object that represents the output audio bus.

### Information and debugging

### .dumpOSC(code: 1)

#### Arguments:

code |
0 | turn dumping OFF.
1 | print the parsed contents of the message.
2 | print the contents in hexadecimal.
3 | print both the parsed and hexadecimal representations of the contents.
NOTE: `/status` messages won't be posted, when dumping is enabled

### .queryAllNodes(queryControls: false)

Post a representation of this Server's current node tree to the post window. See -plotTree for a graphical variant.

#### Discussion:

Very helpful for debugging. For local servers, this uses g_dumpTree and for remote g_queryTree. See Group and Server Command Reference for more info.s.boot; s.queryAllNodes; // note the root node (ID 0) and the default group (ID 1) s.quit;

### .peakCPU

### .avgCPU

Get peak and average CPU usage.

### .latency

### .latency = value

The current latency of the server. See Scheduling and Server timing for details.

### .sampleRate

An integer representing the nominal sample rate of the server; in other words, the sample rate that was requested of the server when it was booted.

### .actualSampleRate

A floating-point number representing the current hardware sample rate, which may drift.

### .numSynths

Get number of running Synths.

### .numGroups

Get the number of Groups.

### .numUGens

Get the number of running UGens.

### .numSynthDefs

Get number of loaded SynthDefinitions.

### .pid

Get process ID of the running server (if not internal).

### .addr

### .addr = netAddr

The network address of the server as a NetAddr.

### .maxNumClients

If known, the maximum number of clients allowed on the server. Otherwise, the value of ServerOptions: -maxLogins, which is what will be requested after the server boots. This number is not guaranteed to be correct until -serverRunning is `true`.

### .clientID

### .clientID = val

The getter returns the client ID of this client on the remote process. `nil` until the server is running.

The setter attempts to set the client ID of this client for the remote server process. Fails on invalid input or if the server is running. Valid inputs are in the range `[0..(this.maxNumClients-1)]`.

### .hasShmInterface

Returns true if a ServerShmInterface is available. See also Bus: Synchronous control bus methods. The shared memory interface is initialized after first server boot.

WARNING: Currently, the shared memory interface treats server port as an unique identifier. In the rare case when there are multiple servers running on the same machine and listening on the same port, this leads to the shared memory interface of one of the servers being overwritten by the other.

### .serverBooting

`true` if the server is booting, `false` otherwise.

### .hasBooted

`true` if the server has booted. The server is not guaranteed to have a correct clientID, nor is it guaranteed that actions in ServerTree will have run yet.

### .serverRunning

`true` only if the server is fully ready. A server is fully ready once it has booted, received a reply to a `/notify` command, been given a client ID, and after the ServerTree has run.

### .unresponsive

`true` if the server is unresponsive (specifically, if it has failed to respond after ServerOptions: -pingsBeforeConsideredDead ping attempts); `false` otherwise.

### .isLocal

`true` if the server is running on the same machine as sclang, `false` otherwise.

### .remoteControlled

### .remoteControlled = value

`true` if the server is not being controlled by the machine on which it is running, `false` otherwise. This value is the same as `isLocal` unless explicitly set.

### .userSpecifiedClientID

From extension in /Applications/SuperCollider.app/Contents/Resources/SCClassLibrary/deprecated/3.10/deprecated-3.10.sc

Deprecated in 3.9. Returns `false`. Server:clientID can now be set while a server is off, and is locked while the server is running. Thus, userSpecifiedClientID is no longer needed internally, and meaningless.

### Message Bundling

The server provides support for automatically bundling messages. This is quite convenient in object style and ensures synchronous execution. See also Bundled Server Messages

### .makeBundle(time, func, bundle)

The Function `func` is evaluated, and all OSC messages generated by it are deferred and added to a bundle.

#### Arguments:

time | If set to nil or a number the bundle will be automatically sent and executed after the corresponding delay in seconds. If `time` is set to false the bundle will not be sent.
func | The function to evaluate.
bundle | allows you to pass in a preexisting bundle and continue adding to it.

#### Returns:

The bundle so that it can be further used if needed.

#### Discussion:

Calling `sync` inside func will split the bundle and wait for asynchronous actions to complete before continuing.

If an error is encountered while evaluating `func` this method will throw an Error and stop message deferral.s.boot; ( // send a synth def to server SynthDef("tpulse", { arg out=0,freq=700,sawFreq=440.0; Out.ar(out, SyncSaw.ar(freq, sawFreq,0.1) ) }).add; ) // all OSC-commands generated in the function contained below will be added to a bundle // and executed simultaneously after 2 seconds. ( s.makeBundle(2.0, { x = Synth.new("tpulse"); a = Bus.control.set(440); x.map(\freq, a); }); ) x.free; // don't send ( b = s.makeBundle(false, { x = { PinkNoise.ar(0.1) * In.kr(0, 1); }.play; }); ) // now pass b as a pre-existing bundle, and start both synths synchronously ( s.makeBundle(nil, { // nil executes ASAP y = { SinOsc.kr(0.2).abs }.play(x, 0, 0, \addBefore); // sine envelope }, b); ) x.free; y.free; // Throw an Error ( try { s.makeBundle(nil, { s.farkermartin; }); } { |error| ("Look Ma, normal operations resume even though:\n" + error.errorString).postln; x = { FSinOsc.ar(440, 0, 0.2) }.play; // This works fine } ) x.free; // use sync ( s.makeBundle(nil, { b = Buffer.read(s, Platform.resourceDir +/+ "sounds/a11wlk01.wav"); s.sync; // wait until load is done and then send the rest of the bundle x = { PlayBuf.ar(1, b) * 0.5 }.play; }); ) x.free; b.free;

### .bind(func)

Just as in `makeBundle`, the Function `func` is evaluated, and all OSC messages generated by it are deferred and added to a bundle, which is sent to the server, using the server default latency.

#### Discussion:

( s.bind { a = { |freq=100| SinOsc.ar(freq, LFTri.ar(freq)) * 0.2 }.play; s.sync; a.set(\freq, 400); } )

### Shared Controls

The internal server has a number of shared control buses. Their values can be set or polled using the methods below.

### .getSharedControl(num)

get the current value of a shared control bus. num is the index of the bus to poll. This command is synchronous and only works with the internal server.

### .setSharedControl(num, value)

set the current value of a shared control bus to value. num is the index of the bus to set. This command is synchronous and only works with the internal server.

### .allocSharedControls(numControls: 1024)

set the number of shared control buses. Must be done before the internal server is booted. The default is 1024.

### Persistent Node Trees

The class ServerTree can be used to store functions which will be evaluated after the server is booted, after all nodes are freed, and after cmd-. is pressed. This allows, for example, for one to create a persistent basic node structure. ServerTree is evaluated in the method initTree after the default group is created, so its existence can be relied upon.

### .initTree

This method initializes the Default Group and runs ServerTree.

#### Discussion:

This method is called automatically when you boot a Server from the language. N.B. If you started a server app from the command line you will have to call initTree manually if you need this functionality.s.quit; f = {Group.new(s.defaultGroup); "Other code can be evaluated too".postln;}; ServerTree.add(f); s.boot; s.queryAllNodes; // note the group within the default group ServerTree.remove(f);

ServerBoot and ServerQuit provide similar functionality at boot and quit times.

### GUI methods

### .makeGui(w)

From extension in /Applications/SuperCollider.app/Contents/Resources/SCClassLibrary/Common/GUI/PlusGUI/Control/ServerPlusGUI.sc

Create and show the server window. The window responds to a number of keyboard shortcuts:

key | action
`n` | Post a representation of this Server's current node tree to the post window. (See -queryAllNodes)
`N` | As 'n' above but include controls.
`l` | Show input/output level meters. (See -meter)
`p` | Show graphical view of the node tree. (See -plotTree)
(space) | Boot server if not already booted. (See -boot)
`s` | Show scope window. (See -scope)
`f` | Show frequency analyzer window. (See -freqscope)
`d` | Toggle dumping of OSC messages.
`m` | Toggle mute.
`0` | Reset volume to 0 db.

### .makeWindow(w)

From extension in /Applications/SuperCollider.app/Contents/Resources/SCClassLibrary/Common/GUI/PlusGUI/Control/ServerPlusGUI.sc

On most platforms, this is equivalent to `makeGui`. If you are running SuperCollider on Emacs, it makes a server view composed of Emacs widgets.

### .scope(numChannels, index: 0, bufsize: 4096, zoom: 1, rate: 'audio')

From extension in /Applications/SuperCollider.app/Contents/Resources/SCClassLibrary/Common/GUI/PlusGUI/Control/server-scope.sc

Open a scope window showing the output of the Server. see Stethoscope for further details.

#### Arguments:

numChannels | the number of channels to be scoped out. The default is this server's options' numOutputBusChannels.
index | the first channel to be output. The default is 0.
bufsize | the size of the buffer for the ScopeView. The default is 4096.
zoom | a zoom value for the scope's X-axis. Larger values show more. The default is 1.
rate | whether to display audio or control rate buses (either \audio or \control)

### .freqscope

From extension in /Applications/SuperCollider.app/Contents/Resources/SCClassLibrary/Common/GUI/PlusGUI/Control/server-scope.sc

Show frequency analyzer window.

### .meter(numIns, numOuts)

From extension in /Applications/SuperCollider.app/Contents/Resources/SCClassLibrary/Common/GUI/PlusGUI/Control/server-meter.sc

Show input/output level meters.

### .plotTree(interval: 0.5)

From extension in /Applications/SuperCollider.app/Contents/Resources/SCClassLibrary/Common/GUI/PlusGUI/Control/ServerPlusGUI.sc

Plot the node/group tree. As -queryAllNodes but graphical.

#### Arguments:

interval | Polling interval.

### .plotTreeView(interval: 0.5, parent, actionIfFail)

From extension in /Applications/SuperCollider.app/Contents/Resources/SCClassLibrary/Common/GUI/PlusGUI/Control/ServerPlusGUI.sc

Plot the node/group tree graphically on a given view.

#### Arguments:

interval | Polling interval.
parent | Parent view.
actionIfFail | Function to be evaluated in case communication with the server cannot be established.

#### Returns:

Function to be evaluated in order to clean up all actions performed inside the method. To be called for instance by the onClose method of the enclosing window.

### Recording Support

The following methods are for convenience use. For recording with sample-accurate start and stop times you should make your own nodes. See the DiskOut helpfile for more info. For non-realtime recording, see the Non-Realtime Synthesis (NRT) helpfile.

This functionality is also available through the recording button on the server windows. Pressing it once calls record, and pressing it again calls stopRecording (see below). When doing so the file created will be in your recordings folder and be named for the current date and time. The default location of the recordings folder varies from platform to platform but is always stored in `thisProcess.platform.recordingsDir`. Setting this variable allows you to change the default.

NOTE: record creates the recording synth after the Server's default group and uses In.ar. Thus if you add nodes after the recording synth their output will not be captured. To avoid this, either use Node objects (which use the default node as their target) or (when using messaging style) use a target nodeID of 1.s.sendMsg("/s_new", "default", s.nextNodeID, 1,1);

For more detail on this subject see Order of execution, Default Group, and Node Messaging.

See SoundFile for information on the various sample and header formats. Not all sample and header formats are compatible. Note that the sampling rate of the output file will be the same as that of the server app. This can be set using the Server's ServerOptions.

Example:s.boot; // start the server // something to record ( SynthDef("bubbles", { |out| var f, sound; f = LFSaw.kr(0.4, 0, 24, LFSaw.kr([8,7.23], 0, 3, 80)).midicps; // glissando function sound = CombN.ar(SinOsc.ar(f, 0, 0.04), 0.2, 0.2, 4); // echoing sine wave Out.ar(out, sound); }).add; ) x = Synth.new("bubbles"); s.prepareForRecord; // if you want to start recording at a precise moment in time, you have to call this first. s.record; s.pauseRecording; // pausable s.record // start again s.stopRecording; // this closes the file and deallocates the buffer recording node, etc. x.free; // stop the synths // look in your recordings folder and you'll find a file named for this date and time

The recording is done via an of Recorder - a server holds one instance implicitly.

### .prepareForRecord(path, numChannels)

Allocates the necessary buffer, etc. for recording the server's output. (See `record` below.)

#### Arguments:

path | a String representing the path and name of the output file. If the directory does not exist, it will be created for you. (Note, however, that if this fails for any reason, the recording will also fail.)
numChannels | a String the number of output channels to record.

#### Discussion:

If you do not specify a path than a file will be created in your recordings folder (see the note above on this) called SC_thisDateAndTime. Changes to the header or sample format, or to the number of channels must be made before calling this.

### .record(path, bus, numChannels, node, duration)

Starts or resumes recording the output.

#### Arguments:

path | this is optional, and is passed to `prepareForRecord` (above).
bus | the bus to record - defaults to 0
numChannels | the number of channels to record - defaults to server numChannels
node | the node to record - defaults to server rootnode
duration | duration to record - defaults to inf

#### Discussion:

If you have not called prepareForRecord first (see above) then it will be invoked for you (but that adds a slight delay before recording starts for real).

### .pauseRecording

Pauses recording. Can be resumed by executing record again.

### .stopRecording

Stops recording, closes the file, and frees the associated resources.

#### Discussion:

You must call this when finished recording or the output file will be unusable. Cmd-. while recording has the same effect.

### .recChannels

### .recChannels = n

Get/set the number of channels (int) to record. By default this is set to 2 (stereo) but can be increased to record soundfiles with many more channels. Must be called before prepareForRecord.

### .recHeaderFormat

### .recHeaderFormat = string

Get/set the header format (string) of the output file. The default is "aiff". Must be called before prepareForRecord.

### .recSampleFormat

### .recSampleFormat = string

Get/set the sample format (string) of the output file. The default is "float". Must be called before prepareForRecord.

### .recBufSize

### .recBufSize = n

Get/set the size of the Buffer to use with the DiskOut UGen. This must be a power of two. The default is the `sampleRate.nextPowerOfTwo` or the first power of two number of samples longer than one second. Must be called before prepareForRecord.

### Asynchronous Commands

The server provides support for waiting on the completion of asynchronous OSC-commands such as reading or writing sound files. N.B. The following methods must be called from within a running Routine. Explicitly passing in a Condition allows multiple elements to depend on different conditions. The examples below should make clear how all this works.

### .bootSync(condition)

Boot the Server and wait until it has completed before resuming the thread.

#### Arguments:

condition | an optional instance of Condition used for evaluating this.

### .sendMsgSync(condition ... args)

Send the following message to the wait until it has completed before resuming the thread.

#### Arguments:

condition | an optional instance of Condition used for evaluating this.
... args | one or more valid OSC messages.

### .sync(condition, bundles, latency)

Send a `/sync` message to the server, which will reply with the message `/synced` when all pending asynchronous commands have been completed.

#### Arguments:

condition | an optional instance of Condition used for evaluating this.
bundles | one or more OSC messages which will be bundled before the sync message (thus ensuring that they will arrive before the /sync message).
latency | allows for the message to be evaluated at a specific point in the future.

#### Discussion:

This may be slightly less safe then sendMsgSync under UDP on a wide area network, as packets may arrive out of order, but on a local network should be okay. Under TCP this should always be safe.( Routine.run { var c; // create a condition variable to control execution of the Routine c = Condition.new; s.bootSync(c); \BOOTED.postln; s.sendMsgSync(c, "/b_alloc", 0, 44100, 2); s.sendMsgSync(c, "/b_alloc", 1, 44100, 2); s.sendMsgSync(c, "/b_alloc", 2, 44100, 2); \b_alloc_DONE.postln; }; ) ( Routine.run { var c; // create a condition variable to control execution of the Routine c = Condition.new; s.bootSync(c); \BOOTED.postln; s.sendMsg("/b_alloc", 0, 44100, 2); s.sendMsg("/b_alloc", 1, 44100, 2); s.sendMsg("/b_alloc", 2, 44100, 2); s.sync(c); \b_alloc_DONE.postln; }; )

### Bela

### .belaScope(scopeChannel, index: 0, numChannels)

From extension in /Applications/SuperCollider.app/Contents/Resources/SCClassLibrary/Common/Audio/Bela/BelaScope.sc

Scope a number of channels from a Bus on this Server, to Bela's Oscilloscope (see BelaScope for required setup). It is required that this Server is running on a Bela, and that it is thus capable of using BelaScope.

#### Arguments:

scopeChannel | Bela's oscilloscope channel to start scoping on. This has to be a non-negative number, and can't be changed after scoping starts.
index | This server's bus index to scope. Defaults to 0.
numChannels | Number of channels to send to BelaScope, starting from the index supplied. Defaults to 2, or to ServerOptions: -numOutputBusChannels if index is 0.

#### Returns:

A Synth, linking this Server's desired bus channels to BelaScope's bus.

### Inherited instance methods

### Undocumented instance methods

### .aliveThreadIsRunning

### .aliveThreadPeriod

### .aliveThreadPeriod = val

### .applicationRunning

### .archiveAsCompileString

### .archiveAsObject

### .asBus(rate, numChannels: 1)

From extension in /Applications/SuperCollider.app/Contents/Resources/SCClassLibrary/Common/Control/asBus.sc

### .asGroup

From extension in /Applications/SuperCollider.app/Contents/Resources/SCClassLibrary/Common/Control/asGroup.sc

### .asNodeID

From extension in /Applications/SuperCollider.app/Contents/Resources/SCClassLibrary/Common/Control/asTarget.sc

### .asTarget

From extension in /Applications/SuperCollider.app/Contents/Resources/SCClassLibrary/Common/Control/asTarget.sc

### .audioBusAllocator

### .bootInProcess

### .bootInTerminal

From extension in /Users/zzk/Library/Application Support/SuperCollider/downloaded-quarks/wslib/wslib-classes/Extensions/Server/extServer-bootInTerminal.sc

### .bootInit(recover: false)

### .bootServerApp(onComplete)

### .bufferAllocator

### .cachedBufferAt(bufnum)

### .cachedBuffersDo(func)

### .calculateViewBounds

From extension in /Applications/SuperCollider.app/Contents/Resources/SCClassLibrary/Common/GUI/PlusGUI/Control/ServerPlusGUI.sc

### .closeBundle(time)

### .cmdPeriod

### .connectSharedMemory

### .controlBusAllocator

### .defaultGroupID

### .disconnectSharedMemory

### .dumpMode

### .emacsbuf

### .freeAllBuffers

### .freeDefaultGroups

### .freeMyDefaultGroup

### .getControlBusValue(busIndex)

### .getControlBusValues(busIndex, busChannels)

### .guiClass

From extension in /Users/zzk/Library/Application Support/SuperCollider/downloaded-quarks/crucial-library/ServerTools/plusServer.sc

### .ifNotRunning(func)

### .ifRunning(func, failFunc)

### .inProcess

### .isRecording

### .makeDefaultGroups

### .makeView(w, useRoundButton: true, onColor)

From extension in /Users/zzk/Library/Application Support/SuperCollider/downloaded-quarks/wslib/wslib-classes/GUI/Extensions/extServer-makeView.sc

### .makeView2(w, useRoundButton: true)

From extension in /Users/zzk/Library/Application Support/SuperCollider/downloaded-quarks/wslib/wslib-classes/GUI/Extensions/extServer-makeView.sc

### .name

### .name = argName

### .newAllocators

### .newBufferAllocators

### .newBusAllocators

### .newNodeAllocators

### .newScopeBufferAllocators

### .nextBufferNumber(n)

### .nodeAllocator

### .notified

### .onBootAdd(object)

From extension in /Applications/SuperCollider.app/Contents/Resources/SCClassLibrary/Common/Control/extSystemActions.sc

### .onBootRemove(object)

From extension in /Applications/SuperCollider.app/Contents/Resources/SCClassLibrary/Common/Control/extSystemActions.sc

### .onQuitAdd(object)

From extension in /Applications/SuperCollider.app/Contents/Resources/SCClassLibrary/Common/Control/extSystemActions.sc

### .onQuitRemove(object)

From extension in /Applications/SuperCollider.app/Contents/Resources/SCClassLibrary/Common/Control/extSystemActions.sc

### .openBundle(bundle)

### .quitInProcess

### .recordNode

From extension in /Applications/SuperCollider.app/Contents/Resources/SCClassLibrary/deprecated/3.10/deprecated-3.10.sc

### .recordOnNodeID(nodeID)

From extension in /Users/zzk/Library/Application Support/SuperCollider/downloaded-quarks/wslib/wslib-classes/Extensions/Server/extServer-recordOnNodeID.sc

### .recorder

### .remove

### .schedSync(func)

### .scopeBufferAllocator

### .scopeWindow

### .scopeWindow = value

### .sendDefaultGroups

### .sendDefaultGroupsForClientIDs(clientIDs)

### .sendQuit

### .sendQuit = value

### .sendStatusMsg

### .serverIsRunning

From extension in /Users/zzk/Library/Application Support/SuperCollider/downloaded-quarks/wslib/wslib-classes/GUI/Extensions/extServer-makeView.sc

### .setControlBusValue(busIndex, value)

### .setControlBusValues(busIndex, valueArray)

### .startAliveThread(delay: 0.0)

### .statusWatcher

### .stopAliveThread

### .syncTasks

### .syncThread

### .tree

### .tree = value

### .window

helpfile source: /Applications/SuperCollider.app/Contents/Resources/HelpSource/Classes/Server.schelp
link::Classes/Server::