Categorygithub.com/scgolang/sc
modulepackage
0.1.3
Repository: https://github.com/scgolang/sc.git
Documentation: pkg.go.dev

# README

sc

Package sc provides a way to interface directly with the supercollider server from Go programs.

Go Report Card

Why

Supercollider has a well-deserved reputation for being difficult to learn. I believe that sclang is a big reason for this. I also believe that Go is quite easy to learn, hence replacing sclang with Go makes a lot of sense to me.

Who

See https://github.com/scgolang/sc/blob/master/AUTHORS

What this is not

sc is not intended for livecoding (for more about livecoding see http://en.wikipedia.org/wiki/Live_coding). I may decide someday to support some livecoding-esque features, but for now the goal is to be able to build music applications that use supercollider as the audio engine.

Install

First, and most importantly, you must have supercollider installed (see http://supercollider.github.io/download.html).

Next, you must install go (see https://golang.org/dl).

Then

go get github.com/scgolang/sc

Test

There are a handful of synthdef files that are necessary for the tests.

These synthdef files are created by sclang, so you have to

make test

instead of

go test

Also, there are tests that attempt to connect to scsynth on port 57120 (see client_test.go).

If you do not have scsynth running the test will hang, so run

scsynth -u 57120

Usage

Find godocs at http://godoc.org/github.com/scgolang/sc. Also, take a look at some of the example programs here: https://github.com/scgolang/examples.

The list of supported ugens is here: https://github.com/scgolang/sc/blob/master/UGENS.md

Develop

See https://github.com/scgolang/sc/blob/master/CONTRIBUTING and https://github.com/scgolang/sc/blob/master/HACKING.md.

Roadmap

See https://github.com/scgolang/sc/milestones

Thanks

This project is hugely indebted to

# Functions

BinOpAdd creates a BinaryOpUGen that represents addition.
BinOpMax creates a BinaryOpUgen that represents the maximum of two signals.
BinOpMul creates a BinaryOpUGen that represents multiplication.
CheckRate causes a panic if rate is not IR, KR, or AR.
DefaultClient returns the default sc client.
Midicps converts midi note values to frequency in Hz.
Mix will mix an array of channels down to a single channel.
MulAdd creates a MulAdd ugen.
Multi does multichannel expansion.
NewClient creates a new SuperCollider client.
NewControl creates a new Control.
NewMultiNode creates a new MultiNode.
NewSynthdef creates a synthdef by traversing a ugen graph.
NewUgenNode is a factory function for creating new UgenNode instances.
Play corresponds to http://doc.sccode.org/Classes/Function.html#-play.
PlayDef plays a synthdef by sending the synthdef using DefaultClient, then immediately creating a synth node from the def.
ReadSynthdef reads a synthdef from an io.Reader.
Sum3 sums three signals.
Sum4 sums four signals.
UgenInput creates a ugen suitable for use as an input to other ugens.
UnaryOpSoftClip adds distortion to a ugen.

# Constants

Arguments to s_new command.
Arguments to s_new command.
Arguments to s_new command.
Arguments to s_new command.
Arguments to s_new command.
Ugen rates.
BufferFlagClear causes the buffer to be cleared before new partials are written using the Gen method.
BufferFlagNormalize causes the peak amplitude of the buffer to be normalized to 1.0 when using the Gen method.
BufferFlagWavetable causes the buffer to be written in wavetable format when using the Gen method, so that it can be used by interpolating oscillators.
BufferRoutineCheby generates a buffer that contains a series of chebyshev polynomials which can be defined as cheby(n) = amplitude * cos(n * acos(x)) The first arg specifies the amplitude for n = 1, the second arg specifies the amplitude for n = 2, and so on.
BufferRoutineSine1 generates a buffer with a series of sine partials.
BufferRoutineSine2 is similar to BufferRoutineSine1 except that the args are pairs of frequency and amplitude (i.e.
BufferRoutineSine3 is similar to BufferRoutineSine1 except that the args are triplets of frequency, amplitude, and phase (i.e.
CurveCubed is a cubed envelope segment.
CurveCustom is an undocumented (on doc.sccode.org) envelope segment shape.
CurveExp is an exponential envelope segment.
CurveLinear is a linear envelope segment.
CurveSine is a sinusoidal shaped envelope segment.
CurveSquared is a squared envelope segment.
CurveStep is a flat envelope segment.
CurveWelch is a sinusoidal segment shaped like the sides of a welch window.
UGen done actions, see http://doc.sccode.org/Reference/UGen-doneActions.html.
UGen done actions, see http://doc.sccode.org/Reference/UGen-doneActions.html.
DefaultConnectTimeout is the default timeout for connecting to scsynth.
DefaultGroupID is what sclang uses for the default group ID.
DefaultLocalAddr is the listening address for DefaultClient.
DefaultScsynthAddr is the remote address for DefaultClient.
DefaultServerPort is the default listening port for scsynth.
UGen done actions, see http://doc.sccode.org/Reference/UGen-doneActions.html.
Arguments to dumpOSC command.
Arguments to dumpOSC command.
Arguments to dumpOSC command.
Arguments to dumpOSC command.
UGen done actions, see http://doc.sccode.org/Reference/UGen-doneActions.html.
UGen done actions, see http://doc.sccode.org/Reference/UGen-doneActions.html.
UGen done actions, see http://doc.sccode.org/Reference/UGen-doneActions.html.
UGen done actions, see http://doc.sccode.org/Reference/UGen-doneActions.html.
UGen done actions, see http://doc.sccode.org/Reference/UGen-doneActions.html.
UGen done actions, see http://doc.sccode.org/Reference/UGen-doneActions.html.
UGen done actions, see http://doc.sccode.org/Reference/UGen-doneActions.html.
UGen done actions, see http://doc.sccode.org/Reference/UGen-doneActions.html.
UGen done actions, see http://doc.sccode.org/Reference/UGen-doneActions.html.
UGen done actions, see http://doc.sccode.org/Reference/UGen-doneActions.html.
Envelope shapes for grain amp envelope.
GrainBufDefaultMaxGrains is the default value of MaxGrains.
Envelope shapes for grain amp envelope.
Envelope shapes for grain amp envelope.
Envelope shapes for grain amp envelope.
Interpolation types.
Interpolation types.
Interpolation types.
Ugen rates.
Ugen rates.
Noise interpolation types.
Noise interpolation types.
Noise interpolation types.
UGen done actions, see http://doc.sccode.org/Reference/UGen-doneActions.html.
RootNodeID is what sclang uses as the root node ID.
ServerPath is the path the scsynth executable on linux systems.

# Variables

ErrNoScsynth happens when you try to start a SuperCollider server but do not have an scsynth executable in your PATH.
Common errors.

# Structs

AllpassC allpass delay with cubic interpolation.
AllpassL allpass delay with linear interpolation.
AllpassN allpass delay with no interpolation.
Balance2 equal power panner.
Blip band-limited impulse generator.
BLowPass is a lowpass filter based on the Second Order Section biquad UGen.
BPF a resonant low pass filter.
BRF a second order band reject filter.
BrownNoise generates noise whose spectrum falls off in power by 6 dB per octave.
Buffer is a client-side representation of an scsynth audio buffer.
Client manages all communication with scsynth.
ClipNoise generates noise whose values are either -1 or 1.
Comb is a delay line with cubic interpolation.
Control represents a synth control.
COsc is a chorusing wavetable lookup oscillator.
Crackle is a noise generator based on a chaotic function.
Decay is an exponential decay.
Decay2 is just like Decay, except it rounds off the attack by subtracting one Decay from another.
Delay is a simple delay line.
DetectSilence evaluates Done when input falls below a certain threshold.
Dust generates random impulses from 0 to +1.
Dust2 generates random impulses from -1 to +1.
Env is a specification for a breakpoint envelope.
EnvADSR represents the ever-popular ADSR envelope.
EnvASR is an attack-sustain-release envelope.
EnvCutoff creates an envelope with no attack segment.
EnvDADSR is EnvADSR with its onset delayed by D seconds.
EnvGen plays back breakpoint envelopes.
EnvLinen creates a new envelope which has a trapezoidal shape.
EnvPairs creates a new envelope from coordinates/pairs.
EnvPerc creates a new envelope that has a percussive shape.
EnvSine creates a new envelope which has a hanning window shape.
EnvTriangle creates a new envelope that has a triangle shape.
Formlet is a resonant filter whose impulse response is like that of a sine wave with a Decay2 envelope over it.
FreeVerb reverb implemented with faust.
FSinOsc is a very fast sine wave generator implemented using a ringing filter.
Gate allows an input signal value to pass when gate is positive, otherwise holds last value.
GrainBuf is a table-lookup sinewave oscillator.
GrainFM is a table-lookup sinewave oscillator.
GrayNoise generates noise which results from flipping random bits in a word.
Group is a group of synth nodes.
Impulse non-band-limited single-sample impulses.
Integrator integrates an input signal with a leak.
Klank is a bank of fixed frequency resonators which can be used to simulate the resonant modes of an object.
LFCub is a sine-like shape made of two cubic pieces.
LFDNoise generates random values at a rate given by the freq argument, with two differences: no time quantization, and fast recovery from low freq values.
LFNoise generates random values at a rate given by the nearest integer division of the sample rate by the Freq input.
LFPulse a non-band-limited pulse oscillator.
LFSaw a non-band-limited sawtooth oscillator output ranges from -1 to +1.
LFTri is a non-band-limited triangle oscillator.
Limiter limits the input amplitude to the given level.
Line generates a line from the start value to the end value.
MouseX allpass delay with cubic interpolation.
MouseY allpass delay with cubic interpolation.
MultiNode is a MultiInput that consists of ugens.
Node is a node in a graph.
Out writes a signal to a bus.
Pan2 is a two-channel equal power panner.
ParamName represents a parameter name of a synthdef.
PinkNoise generates noise whose spectrum falls off in power by 3 dB per octave.
PlayBuf plays back a sample from memory.
PMOsc is a phase modulation sine-wave oscillator pair.
Pulse band-limited pulse wave generator with pulse width modulation.
Rand generates a single random float value in uniform distribution from Lo to Hi.
RLPF a resonant low pass filter.
Saw is a band-limited sawtooth wave generator.
Select selects an output from an array of inputs.
Server represents a running instance of scsynth.
ServerStatus represents the reply to the /status command.
SinOsc is a table-lookup sinewave oscillator.
Synth encapsulates a synth node.
SynthArgs contains the arguments necessary to create a synth that is part of a group.
Synthdef defines the structure of synthdef data as defined in http://doc.sccode.org/Reference/Synth-Definition-File-Format.html.
TLC (time, level, curve) triplet.
UgenNode represents a node in a ugen graph.
Variant provides a way to create synthdef presets.
WhiteNoise generates noise whose spectrum has equal power at all frequencies.
XLine generates an exponential curve from the start value to the end value.

# Interfaces

Envelope is an interface that should be implemented by types that define envelopes for EnvGen.
Input is implemented by any value that can serve as a ugen input.
MultiInput is the interface of an input that causes cascading multi-channel expansion.
Param is the interface of a single synthdef parameter.
Params is an interface that allows you to add parameters to a synthdef.
Ugen defines the interface between synthdefs and ugens.

# Type aliases

C wraps a float32 and implements the Input interface.
EnvTLC creates a new envelope from an array of (time, level, curve) triplets This is renamed from Env.xyc.
Inputs is a slice of Input.
Interpolation is a smoothing strategy for delay lines.
NoiseInterpolation defines different types of interpolation for LFNoise ugens.
Output is a ugen output.
Pairs are pairs of floats: the first float is time, the second is level.
UgenFunc is a func that is used to define a ugen graph.