SuperCollider CLASSES (extension)

Getenv
ExtensionExtension

Read (numeric) shell environment variables into a synth
Inherits from: UGen : AbstractFunction : Object

Description

Tries to grab a shell environment variable (with name key) and convert it to a floating-point value, which is output.

If the environment variable is not set, defaultval is output.

If the environment variable cannot be converted to a floating-point value, the output is zero.

NOTE: the shell context is that of the server, not the client.

Class Methods

Inherited class methods

Undocumented class methods

*new (key, defaultval: 0)

Instance Methods

Inherited instance methods

Examples

Server.local.quit; // If server running, need to stop it for this example

// We'll modify the server boot procedure to set our env var...
~realserverprogram = Server.program;
Server.program = "export PANCREAS=220;" + Server.program
s.boot;

(
x = {
// Env var specifies frequency.
// If you change the env var name to one that isn't set, 440 is used.
SinOsc.ar(Getenv(\PANCREAS, 440), 0, 0.1);
}.play(Server.local);
)
x.free;

// This should restore the variable to what it was
Server.program = ~realserverprogram;