rsc3/doc-schelp/Help-3.12.2/Reference/Server-Architecture.html

116 lines
15 KiB
HTML
Raw Permalink Normal View History

2022-08-24 13:53:18 +00:00
<html><head><title>Server Architecture</title>
<link rel='stylesheet' href='./../scdoc.css' type='text/css' />
<link rel='stylesheet' href='./../frontend.css' type='text/css' />
<link rel='stylesheet' href='./../custom.css' type='text/css' />
<meta http-equiv='Content-Type' content='text/html; charset=UTF-8' />
<script src='./../scdoc.js' type='text/javascript'></script>
<script src='./../docmap.js' type='text/javascript'></script>
<script src='./../prettify.js' type='text/javascript'></script>
<script src='./../lang-sc.js' type='text/javascript'></script>
<script type='text/javascript'>var helpRoot='./..';</script>
</head>
<ul id='menubar'></ul>
<body onload='fixTOC();prettyPrint()'>
<div class='contents'>
<div class='header'>
<div id='label'>SuperCollider REFERENCE</div>
<div id='categories'><a href='./../Browse.html#Server>Architecture'>Server>Architecture</a></div>
<h1>Server Architecture</h1>
<div id='summary'>SuperCollider 3 Synth Server Architecture</div>
</div>
<div class='subheader'>
</div>
<div id='toc'>
<ul class='toc'><li class='toc1'><a href='#Introduction'>Introduction</a></li>
<ul class='toc'></ul><li class='toc1'><a href='#Main%20Design%20Concepts'>Main Design Concepts</a></li>
<ul class='toc'><li class='toc2'><a href='#Node'>Node</a></li>
<ul class='toc'></ul><li class='toc2'><a href='#Group'>Group</a></li>
<ul class='toc'></ul><li class='toc2'><a href='#Synth'>Synth</a></li>
<ul class='toc'></ul><li class='toc2'><a href='#Synth%20Definition'>Synth Definition</a></li>
<ul class='toc'></ul><li class='toc2'><a href='#Audio%20Buses'>Audio Buses</a></li>
<ul class='toc'></ul><li class='toc2'><a href='#Control%20Buses'>Control Buses</a></li>
<ul class='toc'></ul><li class='toc2'><a href='#Buffers'>Buffers</a></li>
<ul class='toc'></ul><li class='toc2'><a href='#Unit%20Generator%20Definitions'>Unit Generator Definitions</a></li>
<ul class='toc'></ul></ul><li class='toc1'><a href='#Command%20Line%20Arguments'>Command Line Arguments</a></li>
<ul class='toc'><li class='toc2'><a href='#Example'>Example</a></li>
<ul class='toc'></ul></ul><li class='toc1'><a href='#Binary%20Format%20of%20Messages'>Binary Format of Messages</a></li>
<ul class='toc'><li class='toc2'><a href='#Types'>Types</a></li>
<ul class='toc'></ul><li class='toc2'><a href='#Tags'>Tags</a></li>
<ul class='toc'></ul><li class='toc2'><a href='#Command'>Command</a></li>
<ul class='toc'></ul><li class='toc2'><a href='#Bundle'>Bundle</a></li>
<ul class='toc'></ul><li class='toc2'><a href='#Message'>Message</a></li>
<ul class='toc'></ul></ul><li class='toc1'><a href='#Glossary'>Glossary</a></li>
<ul class='toc'></ul></ul></div>
<p>copyright © 2002 James McCartney<div class='note'><span class='notelabel'>NOTE:</span> Converted to new help system 2010 by Jonatan Liljedahl. Some stuff in this doc are outdated.</div><h2><a class='anchor' name='Introduction'>Introduction</a></h2>
<p>The SuperCollider 3 Synth Server is a simple but powerful synthesis engine. While synthesis is running, new modules can be created, destroyed and repatched, sample buffers can be created and reallocated. Effects processes can be created and patched into a signal flow dynamically at scheduled times. All running modules are ordered in a tree of nodes that define an order of execution. Patching between modules is done through global audio and control buses.
<p>All commands are received via TCP or UDP using a simplified version of <a href="./../Browse.html#OpenSoundControl">Open Sound Control</a> (OSC). The synth server and its client(s) may be on the same machine or across a network. The synth server does not send or receive MIDI. It is expected that the client will send all control commands. If MIDI is desired, it is up to the client to receive it and convert it to appropriate OSC commands for the synth engine.
<p>Synth definitions are stored in files generated by the SuperCollider language application. Unit generator definitions are Mach-O bundles (not to be confused with CFBundles). The Unit generator API is a simple C interface.<h2><a class='anchor' name='Main%20Design%20Concepts'>Main Design Concepts</a></h2>
<h3><a class='anchor' name='Node'>Node</a></h3>
<p>A Node is an addressable node in a tree of nodes run by the synth engine. There are two types, Synths and Groups. The tree defines the order of execution of all Synths. All nodes have an integer ID.<h3><a class='anchor' name='Group'>Group</a></h3>
<p>A Group is a collection of Nodes represented as a linked list. A new Node may be added to the head or tail of the group. The Nodes within a Group may be controlled together. The Nodes in a Group may be both Synths and other Groups. At startup there is a top level group with an ID of zero that defines the root of the tree. If the server was booted from within SCLang (as opposed to from the command line) there will also be a 'default group' with an ID of 1 which is the default target for all new Nodes. See <a href="./../Classes/RootNode.html">RootNode</a> and <a href="./../Reference/default_group.html">default_group</a> for more info.<h3><a class='anchor' name='Synth'>Synth</a></h3>
<p>A Synth is a collection of unit generators that run together. They can be addressed and controlled by commands to the synthesis engine. They read input and write output to global audio and control buses. Synths can have their own local controls that are set via commands to the server.<h3><a class='anchor' name='Synth%20Definition'>Synth Definition</a></h3>
<p>Synths are created from Synth Definitions. Synth Definition files are created by the SuperCollider language application and are loaded into the synth server. Synth Definitions are referred to by name.<h3><a class='anchor' name='Audio%20Buses'>Audio Buses</a></h3>
<p>Synths send audio signals to each other via a single global array of audio buses. Audio buses are indexed by integers beginning with zero. Using buses rather than connecting synths to each other directly allows synths to connect themselves to the community of other synths without having to know anything about them specifically. The lowest numbered buses get written to the audio hardware outputs. Immediately following the output buses are the input buses, read from the audio hardware inputs. The number of bus channels defined as inputs and outputs do not have to match that of the hardware.<h3><a class='anchor' name='Control%20Buses'>Control Buses</a></h3>
<p>Synths can send control signals to each other via a single global array of control buses. Buses are indexed by integers beginning with zero.<h3><a class='anchor' name='Buffers'>Buffers</a></h3>
<p>Buffers are arrays of 32 bit floating point values with a small descriptive header. Buffers are stored in a single global array indexed by integers beginning with zero. Buffers may be safely allocated, loaded and freed while synthesis is running, even while unit generators are using them. Buffers are used for wave tables, sample buffers, delay lines, envelopes, or for any other need which can use an array of floating point values. Sound files may be loaded into or written from buffers.<h3><a class='anchor' name='Unit%20Generator%20Definitions'>Unit Generator Definitions</a></h3>
<p>Unit Generator Definitions are plug-ins loaded automatically when the program starts. They are binary code libraries that are used as building blocks by Synths to build synthesis algorithms. Unit Generator Definitions have names that match the names of SuperCollider language classes used in building Synth Definitions.<h2><a class='anchor' name='Command%20Line%20Arguments'>Command Line Arguments</a></h2>
<p>One of -u or -t must be supplied. Both may be supplied.<dl>
<dt>-u udp-port-number<dd>a port number 0-65535.<dt>-t tcp-port-number<dd>a port number 0-65535<dt>-v verbosity<dd>Controls the verbosity of server messages. A value of 0 is normal behaviour, -1 suppresses informational messages, and -2 suppresses informational and many error messages.<dt>-a num-audio-bus-channels<dd>number of audio bus channels (default = 1024). The space allocated for audio buses is: (numchannels * (blocksize + 1) * 4)<dt>-i num-input-bus-channels<dd>number of audio input bus channels (default = 8)<dt>-o num-output-bus-channels<dd>number of audio output bus channels (default = 8)<dt>-c num-control-bus-channels<dd>number of control bus channels (default = 16384). The space allocated for control buses is: (numchannels * 8)<dt>-b num-buffers<dd>number of sample buffers (default = 1024)<dt>-n max-nodes<dd>maximum number of nodes (default = 1024)<dt>-d max-synth-defs<dd>maximum number of synth definitions (default = 1024)<dt>-D 1 or 0<dd>if zero, then synth definitions will not be loaded on start up. (default = 1)<dt>-z block-size<dd>The number of samples in one control period. (default = 64)<dt>-Z preferred-hardware-buffer-size<dd>If non-zero, it will attempt to set the hardware buffer frame size. (default = 0)<dt>-S preferred-sample-rate<dd>If non-zero, it will attempt to set the hardware sample rate. (default = 0)<dt>-m real-time-memory-size<dd>The number of kilobytes of real time memory. This memory is used to allocate synths and any memory that unit generators themselves allocate. (default = 8192)<dt>-r random-number-generators<dd>The number of seedable random number generators. (default = 64)<dt>-w max-interconnect-buffers<dd>The maximum number of buffers that are allocated for buffers to interconnect unit generators. Sets the limit of complexity of synth defs that can be loaded at runtime. This value will be increased if a more complex synth-def is loaded at start up time, but it cannot be increased once synthesis has begun. (default = 64)<dt>-l max-logins<dd>maximum number of named return addresses stored (default = 64). also maximum number of tcp connections accepted<dt>-p session-password<dd>When using TCP, the session password must be the first command sent. The default is no password. UDP ports never require passwords, so if password protection is desired, use TCP.<dt>-H device-name<dd>name of the hardware I/O device. If not provided, the default device is used.<dt>-I input-streams-enable-string<dd>Allows turning off input streams that you are not interested in on the device. If the string is 01100, for example, then only the second and third input streams on the device will be enabled. Turning off streams can reduce CPU load.<dt>-O output-streams-enable-string<dd>Allows turning off output streams that you are not interested in on the device. If the string is 11000, for example, then only the first two output streams on the device will be enabled. Turning off streams can reduce CPU load.<dt>-N cmd-filename input-filename output-filename sample-rate header-format sample-format<dd>Run in non-real-time mode.
<p>The cmd-filename should be a file that contains OSC bundles sorted in ascending time order. If cmd-filename is the underscore character _, then OSC will be streamed from standard input.
<p>The audio input will taken from input-filename. If input-filename is the underscore character _, then no input file will be read.
<p>Output will be written to output-filename.
<p>The output file's sample rate is specified by sample-rate. The output file header-format should be one of: AIFF, WAVE, NeXT. The output file sample-format should be one of: int16, int24, int32, float, double. The number of channels in the output file is specified with the -o argument.</dl>
<h3><a class='anchor' name='Example'>Example</a></h3>
<pre class='code prettyprint lang-sc'>scscynth -u 57117 &gt;synth_log &amp;
Accept commands via UDP on port 57117.
Send output to file "synth_log"
Run asynchronously: &amp;.
scsynth -N score.osc _ out.aiff 48000 AIFF int24
Run in non real time mode with command file score.osc,
no input file, and output file named out.aiff.
Sample rate is 48000. Output file header format is aiff,
sample format is 24 bit integer.</pre>
<h2><a class='anchor' name='Binary%20Format%20of%20Messages'>Binary Format of Messages</a></h2>
<p>Messages are similar in format to Open Sound Control messages, except that OSC #bundles may not be nested, and pattern matching of the command name is not performed. When streamed via TCP, Messages are each preceded by a 32 bit integer giving the length in bytes of the message. UDP datagrams contain this length information already.<h3><a class='anchor' name='Types'>Types</a></h3>
<p>All values are in network byte order.<table>
<tr><td>long<td>a 64 bit integer. Used for time stamps only.<tr><td>int<td>a 32 bit integer.<tr><td>float<td>a 32 bit single precision floating point number.<tr><td>double<td>a 64 bit double precision floating point number.<tr><td>string<td>a string of 8 bit ASCII characters, zero padded to a multiple of 4 bytes.<tr><td>bytes<td>a buffer of data preceded by a 32 bit length field and padded to a multiple of 4 bytes.</table>
<h3><a class='anchor' name='Tags'>Tags</a></h3>
<p>Command arguments have single character tags which occur in a tag string to identify their types.<table>
<tr><td>'i'<td>an int.<tr><td>'f'<td>a float<tr><td>'s'<td>a string<tr><td>'b'<td>bytes</table>
<h3><a class='anchor' name='Command'>Command</a></h3>
<p>a Command consists of:<table>
<tr><td>string<td>the command name. See the Command Reference below.<tr><td>string<td>a string with tags defined by the types of the arguments to follow. The tag string begins with a comma ',' character.<tr><td>...<td>any combination of arguments of types: int, float, string or bytes.</table>
<h3><a class='anchor' name='Bundle'>Bundle</a></h3>
<p>a Bundle consists of:<table>
<tr><td>time stamp<td>long. Time stamps are in the same format as defined by Open Sound Control : The top 32 bits are seconds since 1900 and the lower 32 bits represent the 32 bit fraction of one second.<tr><td>...<td>a series of Commands each preceded by a 32-bit integer byte length.</table>
<h3><a class='anchor' name='Message'>Message</a></h3>
<p>a Message consists of:<dl>
<dt>using UDP<dd><ul>
<li>one Bundle or one Command.</ul>
<p><dt>using TCP<dd><ul>
<li>int - the length in bytes of the following message.<li>one Bundle or one Command.</ul>
</dl>
<h2><a class='anchor' name='Glossary'>Glossary</a></h2>
<dl>
<dt>buffer<dd>a header and array of floating point sample data. Buffers are used for sound files, delay lines, arrays of global controls, and arrays of inter-synth patch points.<dt>group<dd>a linked list of nodes. groups provide ways to control execution of many nodes at once. a group is a kind of node.<dt>MIDI<dd>a protocol for sending music control data between synthesizers.<dt>node<dd>an object in a tree of objects executed in a depth first traversal order by the synth engine. There are two types of nodes, synths and groups.<dt>Open Sound Control<dd>a protocol defined by CNMAT at UCBerkeley for controlling synthesizers. See <a href="http://cnmat.cnmat.berkeley.edu/OSC/">http://cnmat.cnmat.berkeley.edu/OSC/</a> .<dt>OSC<dd>see Open Sound Control.<dt>synth<dd>a sound processing module. Similar to "voice " in other systems. Synths are referred to by a number.<dt>synth definition<dd>a definition for creating new synths. similar to "instrument" in other systems.<dt>TCP<dd>a protocol for streaming data over a network.<dt>UDP<dd>a protocol for sending datagrams over a network.</dl>
<div class='doclink'>helpfile source: <a href='file:///Applications/SuperCollider.app/Contents/Resources/HelpSource/Reference/Server-Architecture.schelp'>/Applications/SuperCollider.app/Contents/Resources/HelpSource/Reference/Server-Architecture.schelp</a><br>link::Reference/Server-Architecture::<br>sc version: 3.8.0</div></div></body></html>