Safety protects users from risky sound signals in two respects: It replaces bad values before they leave the software and enter the sound device, and it keeps the signal within +-1 (or a user-set lower limit) given by clipping, limiting, or other methods.
When the Safety quark is installed, it is on by default so that newbie users are safe; it can be turned off if desired. It puts itself at the tail of the rootnode; thus scope will be added after it, and master volume goes before it.
In ReplaceBadValues see esp. the method ugen.zap for suppressing bad numbers individually per synth.
First code examples:
dict for all Safety objects
enable and disable all Safety objects at once
detect all present servers, and make Safety objects for them. When creating server by hand, run this method to use Safety on them too.
dict for all synthDef-generating functions Safety can use
get and set the name the default synthdef to use
add a function to create a safety synthDef by name.
make a synthDef from a named synthDefFunc for a given number of channels
get and set whether to add safety synth to tail of rootnode or not. true by default. if false, safety synth will run after server.defaultGroup.
make a new Safety, needed only when creating a custom server.
server |
the server for which to make the safety |
defName |
the name of the synthdef it should use |
enable |
flag whether to enable this safety when making it. |
numChannels |
sets number of output channels to protect by Safety. Only needed if different from s.options.numOutputBusChannels. |
the server of this safety
get and set the name of the synthdef to use for this safety
the synth running for this safety
the function in ServerTree used to send safety synth when booting or after cmd-period.
the number of output channels of safety.server
flag whether this safety is enabled
enable and disable safety.
When Safety.useRootNode is true, this returns the server's rootnode; when false, it returns the server. This is used as target to whose tail the safety's synth will be added.