sc3nb.sc_objects.server
Module for managing Server related stuff.
Module Contents
Class List
Reply addresses of the Master Control Commands. |
|
Master Control commands of scsynth. |
|
Specific reply addresses. |
|
Information about the status of the Server program |
|
Information about the version of the Server program |
|
Options for the SuperCollider audio server |
|
The NodeWatcher is used to handle Node Notifications. |
|
A simple class for storing a function and arguments and allows later execution. |
|
SuperCollider audio server representaion. |
Content
- class sc3nb.sc_objects.server.MasterControlReply[source]
-
Reply addresses of the Master Control Commands.
Initialize self. See help(type(self)) for accurate signature.
- class sc3nb.sc_objects.server.MasterControlCommand[source]
-
Master Control commands of scsynth.
Initialize self. See help(type(self)) for accurate signature.
- class sc3nb.sc_objects.server.ReplyAddress[source]
-
Specific reply addresses.
Initialize self. See help(type(self)) for accurate signature.
- class sc3nb.sc_objects.server.ServerStatus[source]
Bases:
NamedTupleInformation about the status of the Server program
- class sc3nb.sc_objects.server.ServerVersion[source]
Bases:
NamedTupleInformation about the version of the Server program
- class sc3nb.sc_objects.server.ServerOptions(udp_port: int = SCSYNTH_DEFAULT_PORT, max_logins: int = 6, num_input_buses: int = 2, num_output_buses: int = 2, num_audio_buses: int = 1024, num_control_buses: int = 4096, num_sample_buffers: int = 1024, publish_rendezvous: bool = False, block_size: Optional[int] = None, hardware_buffer_size: Optional[int] = None, hardware_sample_size: Optional[int] = None, hardware_input_device: Optional[str] = None, hardware_output_device: Optional[str] = None, other_options: Optional[Sequence[str]] = None)[source]
Options for the SuperCollider audio server
This allows the encapsulation and handling of the command line server options.
Overview:
Return repr(self).
- class sc3nb.sc_objects.server.NodeWatcher(server: SCServer)[source]
The NodeWatcher is used to handle Node Notifications.
- Parameters:
- serverSCServer
Server belonging to the notifications
Overview:
Handle a Notification
- class sc3nb.sc_objects.server.Hook(fun: Callable, *args: Any, **kwargs: Any)[source]
A simple class for storing a function and arguments and allows later execution.
Create a Hook
- Parameters:
- funCallable
Function to be executed
- argsAny, optional
Arguments given to function
- kwargsAny, optional
Keyword arguments given to function
Overview:
Execute the Hook
- class sc3nb.sc_objects.server.SCServer(options: Optional[ServerOptions] = None)[source]
Bases:
sc3nb.osc.osc_communication.OSCCommunicationSuperCollider audio server representaion.
Parameters
- optionsOptional[ServerOptions], optional
Options used to start the local server, by default None
Create an OSC communication server
- Parameters:
- server_ipstr
IP address to use for this server
- server_portint
port to use for this server
- default_receiver_ipstr
IP address used for sending by default
- default_receiver_portint
port used for sending by default
Overview:
Start the Server process.
Initialize the server.
Run all init hook functions.
Connect sclang to the server
Create and add a hook to be executed when the server is initialized
Remove a previously added init Hook
Generate a Bundler with added server latency.
Make a blip sound
Connect to remote Server
Reboot this server
Ping the server.
Quits and tries to kill the server.
Sync the server with the /sync command.
Send a SynthDef as bytes.
Load SynthDef file at path.
Load all SynthDefs from directory.
Notify the server about this client.
Free all node ids.
Send /clearSched to the server.
Send the default groups for all clients.
Mute audio
Set volume back to volume prior to muting
Server version information
Server status information
Enable dumping incoming OSC messages at the server process
Server process prints out current nodes
Query all nodes at the server and return a NodeTree
Return repr(self).
- boot(scsynth_path: Optional[str] = None, timeout: float = 5, console_logging: bool = True, with_blip: bool = True, kill_others: bool = True, allowed_parents: Sequence[str] = ALLOWED_PARENTS)[source]
Start the Server process.
- Parameters:
- scsynth_pathstr, optional
Path of scscynth executable, by default None
- timeoutfloat, optional
Timeout for starting the executable, by default 5
- console_loggingbool, optional
If True write process output to console, by default True
- with_blipbool, optional
make a sound when booted, by default True
- kill_othersbool
kill other SuperCollider server processes.
- allowed_parentsSequence[str], optional
Names of parents that are allowed for other instances of scsynth processes that won’t be killed, by default ALLOWED_PARENTS
- Raises:
- ValueError
If UDP port specified in options is already used
- ProcessTimeout
If the process fails to start.
- init(with_blip: bool = True)[source]
Initialize the server.
This adds allocators, loads SynthDefs, send default Groups etc.
- Parameters:
- with_blipbool, optional
make a sound when initialized, by default True
- execute_init_hooks() None[source]
Run all init hook functions.
This is automatically done when running free_all, init or connect_sclang.
Hooks can be added using add_init_hook
- connect_sclang(port: int) None[source]
Connect sclang to the server
This will add the “sclang” receiver and execute the init hooks
- Parameters:
- portint
Port of sclang (NetAddr.langPort)
- add_init_hook(fun: Callable, *args: Any, **kwargs: Any) Hook[source]
Create and add a hook to be executed when the server is initialized
- Parameters:
- hookCallable[…, None]
Function to be executed
- argsAny, optional
Arguments given to function
- kwargsAny, optional
Keyword arguments given to function
- Returns:
- Hook
The created Hook
- remove_init_hook(hook: Hook)[source]
Remove a previously added init Hook
- Parameters:
- hookHook
the hook to be removed
- bundler(timetag=0, msg=None, msg_params=None, send_on_exit=True)[source]
Generate a Bundler with added server latency.
This allows the user to easly add messages/bundles and send it.
- Parameters:
- timetagfloat
Time at which bundle content should be executed. This servers latency will be added upon this. If timetag <= 1e6 it is added to time.time().
- msg_addrstr
SuperCollider address.
- msg_paramslist, optional
- List of parameters to add to message.
(Default value = None)
- Returns:
- Bundler
bundler for OSC bundling.
- remote(address: str, port: int, with_blip: bool = True) None[source]
Connect to remote Server
- Parameters:
- addressstr
address of remote server
- portint
port of remote server
- with_blipbool, optional
make a sound when initialized, by default True
- reboot() None[source]
Reboot this server
- Raises:
- RuntimeError
If this server is remote and can’t be restarted.
- sync(timeout=5) bool[source]
Sync the server with the /sync command.
- Parameters:
- timeoutint, optional
- Time in seconds that will be waited for sync.
(Default value = 5)
- Returns:
- bool
True if sync worked.
- send_synthdef(synthdef_bytes: bytes)[source]
Send a SynthDef as bytes.
- Parameters:
- synthdef_bytesbytes
SynthDef bytes
- waitbool
If True wait for server reply.
- load_synthdef(synthdef_path: str)[source]
Load SynthDef file at path.
- Parameters:
- synthdef_pathstr
Path with the SynthDefs
- bundlebool
Wether the OSC Messages can be bundle or not. If True sc3nb will not wait for the server response, by default False
- load_synthdefs(synthdef_dir: Optional[str] = None, completion_msg: Optional[bytes] = None) None[source]
Load all SynthDefs from directory.
- Parameters:
- synthdef_dirstr, optional
directory with SynthDefs, by default sc3nb default SynthDefs
- completion_msgbytes, optional
Message to be executed by the server when loaded, by default None
- notify(receive_notifications: bool = True, client_id: Optional[int] = None, timeout: float = 1) None[source]
Notify the server about this client.
This provides the client id and max logins info needed for default groups.
- Parameters:
- receive_notificationsbool, optional
Flag for receiving node notification from server, by default True
- client_idint, optional
Propose a client id, by default None
- timeoutfloat, optional
Timeout for server reply, by default 1.0
- Raises:
- RuntimeError
If server has too many users.
- OSCCommunicationError
If OSC communication fails.
- free_all(root: bool = True) None[source]
Free all node ids.
- Parameters:
- rootbool, optional
If False free only the default group of this client, by default True
- clear_schedule()[source]
Send /clearSched to the server.
This clears all scheduled bundles and removes all bundles from the scheduling queue.
- version() ServerVersion[source]
Server version information
- status() ServerStatus[source]
Server status information
- dump_osc(level: int = 1) None[source]
Enable dumping incoming OSC messages at the server process
- Parameters:
- levelint, optional
Verbosity code, by default 1 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.
- dump_tree(controls: bool = True, return_tree=False) Optional[str][source]
Server process prints out current nodes
- Parameters:
- controlsbool, optional
If True include control values, by default True
- return_treebool, optional
If True return output as string, by default False
- Returns:
- str
If return_tree this is the node tree string.
- query_tree(include_controls: bool = True) sc3nb.sc_objects.node.Group[source]
Query all nodes at the server and return a NodeTree
- Parameters:
- include_controlsbool, optional
If True include control values, by default True
- Returns:
- NodeTree
object containing all the nodes.