Documentation ¶
Overview ¶
Package sc is a SuperCollider client for Go.
Index ¶
- Constants
- Variables
- func CheckRate(rate int8)
- func Cpsmidi(cps float32) float32
- func Cpsoct(cps float32) float32
- func Midicps(note float32) float32
- func Octcps(oct float32) float32
- func Play(c *Client, f UgenFunc) error
- func RegisterSynthdef(name string, f UgenFunc) error
- func Roundf(a, b float32) float32
- func Truncf(a, b float32) float32
- type Allpass
- type AnalogIn
- type AnalogOut
- type ArraySpec
- func (as ArraySpec) Abs() Input
- func (as ArraySpec) Absdif(val Input) Input
- func (as ArraySpec) Acos() Input
- func (as ArraySpec) Add(val Input) Input
- func (as ArraySpec) Amclip(val Input) Input
- func (as ArraySpec) AmpDb() Input
- func (as ArraySpec) Asin() Input
- func (as ArraySpec) Atan() Input
- func (as ArraySpec) Atan2(val Input) Input
- func (as ArraySpec) Bilinrand() Input
- func (as ArraySpec) Ceil() Input
- func (as ArraySpec) Clip2(val Input) Input
- func (as ArraySpec) Coin() Input
- func (as ArraySpec) Cos() Input
- func (as ArraySpec) Cosh() Input
- func (as ArraySpec) Cpsmidi() Input
- func (as ArraySpec) Cpsoct() Input
- func (as ArraySpec) Cubed() Input
- func (as ArraySpec) DbAmp() Input
- func (as ArraySpec) Difsqr(val Input) Input
- func (as ArraySpec) Distort() Input
- func (as ArraySpec) Div(val Input) Input
- func (as ArraySpec) Excess(val Input) Input
- func (as ArraySpec) Exp() Input
- func (as ArraySpec) Expon(val Input) Input
- func (as ArraySpec) Floor() Input
- func (as ArraySpec) Fold2(val Input) Input
- func (as ArraySpec) Frac() Input
- func (as ArraySpec) GCD(val Input) Input
- func (as ArraySpec) GT(val Input) Input
- func (as ArraySpec) GTE(val Input) Input
- func (as ArraySpec) Hypot(val Input) Input
- func (as ArraySpec) HypotApx(val Input) Input
- func (as ArraySpec) LCM(val Input) Input
- func (as ArraySpec) LT(val Input) Input
- func (as ArraySpec) LTE(val Input) Input
- func (as ArraySpec) Linrand() Input
- func (as ArraySpec) Log() Input
- func (as ArraySpec) Log10() Input
- func (as ArraySpec) Log2() Input
- func (as ArraySpec) Max(val Input) Input
- func (as ArraySpec) Midicps() Input
- func (as ArraySpec) Midiratio() Input
- func (as ArraySpec) Min(val Input) Input
- func (as ArraySpec) Moddif(y, mod Input) Input
- func (as ArraySpec) Modulo(val Input) Input
- func (as ArraySpec) Mul(val Input) Input
- func (as ArraySpec) MulAdd(m, a Input) Input
- func (as ArraySpec) Neg() Input
- func (as ArraySpec) Octcps() Input
- func (as ArraySpec) Pow(val Input) Input
- func (as ArraySpec) Rand() Input
- func (as ArraySpec) Rand2() Input
- func (as ArraySpec) Ratiomidi() Input
- func (as ArraySpec) Reciprocal() Input
- func (as ArraySpec) Ring1(val Input) Input
- func (as ArraySpec) Ring2(val Input) Input
- func (as ArraySpec) Ring3(val Input) Input
- func (as ArraySpec) Ring4(val Input) Input
- func (as ArraySpec) Round(val Input) Input
- func (as ArraySpec) Scaleneg(val Input) Input
- func (as ArraySpec) Sign() Input
- func (as ArraySpec) Sin() Input
- func (as ArraySpec) Sinh() Input
- func (as ArraySpec) SoftClip() Input
- func (as ArraySpec) Sqrdif(val Input) Input
- func (as ArraySpec) Sqrsum(val Input) Input
- func (as ArraySpec) Sqrt() Input
- func (as ArraySpec) Squared() Input
- func (as ArraySpec) Sum3rand() Input
- func (as ArraySpec) Sumsqr(val Input) Input
- func (as ArraySpec) Tan() Input
- func (as ArraySpec) Tanh() Input
- func (as ArraySpec) Thresh(val Input) Input
- func (as ArraySpec) Trunc(val Input) Input
- func (as ArraySpec) Wrap2(val Input) Input
- type BAllPass
- type BLowPass
- type BPF
- type BRF
- type Balance2
- type Ball
- type Blip
- type BrownNoise
- type Buffer
- type C
- func (c C) Abs() Input
- func (c C) Absdif(val Input) Input
- func (c C) Acos() Input
- func (c C) Add(val Input) Input
- func (c C) Amclip(val Input) Input
- func (c C) AmpDb() Input
- func (c C) Asin() Input
- func (c C) Atan() Input
- func (c C) Atan2(val Input) Input
- func (c C) Bilinrand() Input
- func (c C) Ceil() Input
- func (c C) Clip2(val Input) Input
- func (c C) Coin() Input
- func (c C) Cos() Input
- func (c C) Cosh() Input
- func (c C) Cpsmidi() Input
- func (c C) Cpsoct() Input
- func (c C) Cubed() Input
- func (c C) DbAmp() Input
- func (c C) Difsqr(val Input) Input
- func (c C) Distort() Input
- func (c C) Div(val Input) Input
- func (c C) Excess(val Input) Input
- func (c C) Exp() Input
- func (c C) Expon(val Input) Input
- func (c C) Floor() Input
- func (c C) Fold2(val Input) Input
- func (c C) Frac() Input
- func (c C) GCD(val Input) Input
- func (c C) GT(val Input) Input
- func (c C) GTE(val Input) Input
- func (c C) Hypot(val Input) Input
- func (c C) HypotApx(val Input) Input
- func (c C) LCM(val Input) Input
- func (c C) LT(val Input) Input
- func (c C) LTE(val Input) Input
- func (c C) Linrand() Input
- func (c C) Log() Input
- func (c C) Log10() Input
- func (c C) Log2() Input
- func (c C) Max(other Input) Input
- func (c C) Midicps() Input
- func (c C) Midiratio() Input
- func (c C) Min(other Input) Input
- func (c C) Moddif(y, mod Input) Input
- func (c C) Modulo(val Input) Input
- func (c C) Mul(val Input) Input
- func (c C) MulAdd(mul, add Input) Input
- func (c C) Neg() Input
- func (c C) Octcps() Input
- func (c C) Pow(val Input) Input
- func (c C) Rand() Input
- func (c C) Rand2() Input
- func (c C) Ratiomidi() Input
- func (c C) Reciprocal() Input
- func (c C) Ring1(val Input) Input
- func (c C) Ring2(val Input) Input
- func (c C) Ring3(val Input) Input
- func (c C) Ring4(val Input) Input
- func (c C) Round(val Input) Input
- func (c C) Scaleneg(val Input) Input
- func (c C) Sign() Input
- func (c C) Sin() Input
- func (c C) Sinh() Input
- func (c C) SoftClip() Input
- func (c C) Sqrdif(val Input) Input
- func (c C) Sqrsum(val Input) Input
- func (c C) Sqrt() Input
- func (c C) Squared() Input
- func (c C) Sum3rand() Input
- func (c C) Sumsqr(val Input) Input
- func (c C) Tan() Input
- func (c C) Tanh() Input
- func (c C) Thresh(val Input) Input
- func (c C) Trunc(val Input) Input
- func (c C) Wrap2(val Input) Input
- type COsc
- type Client
- func (c *Client) AddDefaultGroup() (*GroupNode, error)
- func (c *Client) AllocBuffer(frames, channels int) (*Buffer, error)
- func (c *Client) Close() error
- func (c *Client) Connect(addr string, timeout time.Duration) error
- func (c *Client) DumpOSC(level int32) error
- func (c *Client) FreeAll(gids ...int32) error
- func (c *Client) Group(id, action, target int32) (*GroupNode, error)
- func (c *Client) NextSynthID() int32
- func (c *Client) NodeFree(id int32) error
- func (c *Client) NodeMap(id int32, m map[string]int32) error
- func (c *Client) NodeMapa(id int32, m map[string]int32) error
- func (c *Client) NodeSet(id int32, ctls map[string]float32) error
- func (c *Client) QueryBuffer(num int32) (*Buffer, error)
- func (c *Client) QueryGroup(id int32) (*GroupNode, error)
- func (c *Client) ReadBuffer(path string, num int32, channels ...int) (*Buffer, error)
- func (c *Client) SendAllDefs() error
- func (c *Client) SendDef(def *Synthdef) error
- func (c *Client) Status(timeout time.Duration) (*ServerStatus, error)
- func (c *Client) Synth(defName string, id, action, target int32, ctls map[string]float32) (*Synth, error)
- func (c *Client) Synths(args []SynthArgs) error
- type ClipNoise
- type CoinGate
- type Comb
- type ControlRate
- type Crackle
- type DC
- type Decay
- type Decay2
- type DecodeB2
- type Delay
- type DetectSilence
- type DigitalIn
- type DigitalOut
- type Dust
- type Dust2
- type Env
- type EnvADSR
- type EnvASR
- type EnvCutoff
- type EnvDADSR
- type EnvGen
- type EnvLinen
- type EnvPairs
- type EnvPerc
- type EnvSine
- type EnvTLC
- type EnvTriangle
- type Envelope
- type FFT
- type FSinOsc
- type Formant
- type Formlet
- type FreeVerb
- type GVerb
- type Gate
- type Gendy1
- type Gendy2
- type Gendy3
- type GrainBuf
- type GrainFM
- type GrainIn
- type GrainSin
- type GrayNoise
- type GroupNode
- type HPF
- type Hasher
- type IFFT
- type Impulse
- type In
- type Input
- func A(r Rater) Input
- func Fill(n int, input Input) []Input
- func I(r Rater) Input
- func K(r Rater) Input
- func Mix(rate int8, inputs []Input) Input
- func NewInput(name string, rate int8, specialIndex int16, numOutputs int, inputs ...Input) Input
- func RandArray(n int, min, max float64) []Input
- func RandC(min, max float64) Input
- func Sum3(rate int8, in1, in2, in3 Input) Input
- func Sum4(rate int8, in1, in2, in3, in4 Input) Input
- type Inputs
- func (ins Inputs) Abs() Input
- func (ins Inputs) Absdif(val Input) Input
- func (ins Inputs) Acos() Input
- func (ins Inputs) Add(val Input) Input
- func (ins Inputs) Amclip(val Input) Input
- func (ins Inputs) AmpDb() Input
- func (ins Inputs) Asin() Input
- func (ins Inputs) Atan() Input
- func (ins Inputs) Atan2(val Input) Input
- func (ins Inputs) Bilinrand() Input
- func (ins Inputs) Ceil() Input
- func (ins Inputs) Clip2(val Input) Input
- func (ins Inputs) Coin() Input
- func (ins Inputs) Cos() Input
- func (ins Inputs) Cosh() Input
- func (ins Inputs) Cpsmidi() Input
- func (ins Inputs) Cpsoct() Input
- func (ins Inputs) Cubed() Input
- func (ins Inputs) DbAmp() Input
- func (ins Inputs) Difsqr(val Input) Input
- func (ins Inputs) Distort() Input
- func (ins Inputs) Div(val Input) Input
- func (ins Inputs) Excess(val Input) Input
- func (ins Inputs) Exp() Input
- func (ins Inputs) Expon(val Input) Input
- func (ins Inputs) Floor() Input
- func (ins Inputs) Fold2(val Input) Input
- func (ins Inputs) Frac() Input
- func (ins Inputs) GCD(val Input) Input
- func (ins Inputs) GT(val Input) Input
- func (ins Inputs) GTE(val Input) Input
- func (ins Inputs) Hypot(val Input) Input
- func (ins Inputs) HypotApx(val Input) Input
- func (ins Inputs) InputArray() []Input
- func (ins Inputs) LCM(val Input) Input
- func (ins Inputs) LT(val Input) Input
- func (ins Inputs) LTE(val Input) Input
- func (ins Inputs) Linrand() Input
- func (ins Inputs) Log() Input
- func (ins Inputs) Log10() Input
- func (ins Inputs) Log2() Input
- func (ins Inputs) Max(other Input) Input
- func (ins Inputs) Midicps() Input
- func (ins Inputs) Midiratio() Input
- func (ins Inputs) Min(other Input) Input
- func (ins Inputs) Moddif(y, mod Input) Input
- func (ins Inputs) Modulo(val Input) Input
- func (ins Inputs) Mul(val Input) Input
- func (ins Inputs) MulAdd(mul, add Input) Input
- func (ins Inputs) Neg() Input
- func (ins Inputs) Octcps() Input
- func (ins Inputs) Pow(val Input) Input
- func (ins Inputs) Rand() Input
- func (ins Inputs) Rand2() Input
- func (ins Inputs) Ratiomidi() Input
- func (ins Inputs) Reciprocal() Input
- func (ins Inputs) Ring1(val Input) Input
- func (ins Inputs) Ring2(val Input) Input
- func (ins Inputs) Ring3(val Input) Input
- func (ins Inputs) Ring4(val Input) Input
- func (ins Inputs) Round(val Input) Input
- func (ins Inputs) Scaleneg(val Input) Input
- func (ins Inputs) Sign() Input
- func (ins Inputs) Sin() Input
- func (ins Inputs) Sinh() Input
- func (ins Inputs) SoftClip() Input
- func (ins Inputs) Sqrdif(val Input) Input
- func (ins Inputs) Sqrsum(val Input) Input
- func (ins Inputs) Sqrt() Input
- func (ins Inputs) Squared() Input
- func (ins Inputs) Sum3rand() Input
- func (ins Inputs) Sumsqr(val Input) Input
- func (ins Inputs) Tan() Input
- func (ins Inputs) Tanh() Input
- func (ins Inputs) Thresh(val Input) Input
- func (ins Inputs) Trunc(val Input) Input
- func (ins Inputs) Wrap2(val Input) Input
- type Integrator
- type Interpolation
- type JPverb
- type Klang
- type Klank
- type LFClipNoise
- type LFCub
- type LFDClipNoise
- type LFDNoise
- type LFGauss
- type LFNoise
- type LFPar
- type LFPulse
- type LFSaw
- type LFTri
- type LPF
- type Lag
- type Latch
- type LeakDC
- type Limiter
- type LinPan2
- type LinXFade2
- type Line
- type LocalBuf
- type Median
- type MouseX
- type MouseY
- type MultiInput
- type Node
- type NoiseInterpolation
- type NumOutputBuses
- type OffsetOut
- type OnePole
- type OneZero
- type Osc
- type OscN
- type Out
- type Output
- type PMOsc
- type PSinGrain
- type PVBrickWall
- type Pairs
- type Pan2
- type Pan4
- type PanAz
- type PanB2
- type Param
- type ParamName
- type Params
- type PinkNoise
- type PlayBuf
- type Pulse
- type PulseCount
- type PulseDivider
- type RLPF
- type Rand
- type Rater
- type Resonz
- type Ringz
- type Rotate2
- type RunningSum
- type SampleDur
- type SampleRate
- type Saw
- type Select
- type Server
- type ServerStatus
- type Shaper
- type Silent
- type SinOsc
- type SinOscFB
- type Slew
- type Slope
- type SoundIn
- type Spring
- type Sweep
- type SyncSaw
- type Synth
- type SynthArgs
- type SynthControl
- type SynthNode
- type Synthdef
- func (def *Synthdef) Bytes() ([]byte, error)
- func (def *Synthdef) CompareToDef(other *Synthdef) (bool, error)
- func (def *Synthdef) CompareToFile(path string) (bool, error)
- func (def *Synthdef) Diff(other *Synthdef) [][2]string
- func (def *Synthdef) Root() int32
- func (def *Synthdef) Write(w io.Writer) error
- func (def *Synthdef) WriteJSON(w io.Writer) error
- func (def *Synthdef) WriteXML(w io.Writer) error
- type TDelay
- type TGrains
- type TLC
- type TRand
- type ToggleFF
- type Trig
- type Trig1
- type Ugen
- func (u *Ugen) Abs() Input
- func (u *Ugen) Absdif(val Input) Input
- func (u *Ugen) Acos() Input
- func (u *Ugen) Add(val Input) Input
- func (u *Ugen) Amclip(val Input) Input
- func (u *Ugen) AmpDb() Input
- func (u *Ugen) Asin() Input
- func (u *Ugen) Atan() Input
- func (u *Ugen) Atan2(val Input) Input
- func (u *Ugen) Bilinrand() Input
- func (u *Ugen) Ceil() Input
- func (u *Ugen) Clip2(val Input) Input
- func (u *Ugen) Coin() Input
- func (u *Ugen) Cos() Input
- func (u *Ugen) Cosh() Input
- func (u *Ugen) Cpsmidi() Input
- func (u *Ugen) Cpsoct() Input
- func (u *Ugen) Cubed() Input
- func (u *Ugen) DbAmp() Input
- func (u *Ugen) Difsqr(val Input) Input
- func (u *Ugen) Distort() Input
- func (u *Ugen) Div(val Input) Input
- func (u *Ugen) Excess(val Input) Input
- func (u *Ugen) Exp() Input
- func (u *Ugen) Expon(val Input) Input
- func (u *Ugen) Floor() Input
- func (u *Ugen) Fold2(val Input) Input
- func (u *Ugen) Frac() Input
- func (u *Ugen) GCD(val Input) Input
- func (u *Ugen) GT(val Input) Input
- func (u *Ugen) GTE(val Input) Input
- func (u *Ugen) Hypot(val Input) Input
- func (u *Ugen) HypotApx(val Input) Input
- func (u *Ugen) LCM(val Input) Input
- func (u *Ugen) LT(val Input) Input
- func (u *Ugen) LTE(val Input) Input
- func (u *Ugen) Linrand() Input
- func (u *Ugen) Log() Input
- func (u *Ugen) Log10() Input
- func (u *Ugen) Log2() Input
- func (u *Ugen) Max(other Input) Input
- func (u *Ugen) Midicps() Input
- func (u *Ugen) Midiratio() Input
- func (u *Ugen) Min(other Input) Input
- func (u *Ugen) Moddif(y, mod Input) Input
- func (u *Ugen) Modulo(val Input) Input
- func (u *Ugen) Mul(val Input) Input
- func (u *Ugen) MulAdd(mul, add Input) Input
- func (u *Ugen) Neg() Input
- func (u *Ugen) Octcps() Input
- func (u *Ugen) Pow(val Input) Input
- func (u *Ugen) Rand() Input
- func (u *Ugen) Rand2() Input
- func (u *Ugen) Ratiomidi() Input
- func (u *Ugen) Reciprocal() Input
- func (u *Ugen) Ring1(val Input) Input
- func (u *Ugen) Ring2(val Input) Input
- func (u *Ugen) Ring3(val Input) Input
- func (u *Ugen) Ring4(val Input) Input
- func (u *Ugen) Round(val Input) Input
- func (u *Ugen) Scaleneg(val Input) Input
- func (u *Ugen) Sign() Input
- func (u *Ugen) Sin() Input
- func (u *Ugen) Sinh() Input
- func (u *Ugen) SoftClip() Input
- func (u *Ugen) Sqrdif(val Input) Input
- func (u *Ugen) Sqrsum(val Input) Input
- func (u *Ugen) Sqrt() Input
- func (u *Ugen) Squared() Input
- func (u *Ugen) Sum3rand() Input
- func (u *Ugen) Sumsqr(val Input) Input
- func (u *Ugen) Tan() Input
- func (u *Ugen) Tanh() Input
- func (u *Ugen) Thresh(val Input) Input
- func (u *Ugen) Trunc(val Input) Input
- func (u *Ugen) Wrap2(val Input) Input
- func (u *Ugen) Write(w io.Writer) error
- type UgenFunc
- type UgenInput
- type VOsc
- type VOsc3
- type VarSaw
- type Variant
- type Vibrato
- type Warp1
- type WhiteNoise
- type XFade2
- type XLine
Examples ¶
Constants ¶
const ( // BufferFlagNormalize causes the peak amplitude of the buffer // to be normalized to 1.0 when using the Gen method. BufferFlagNormalize = 0x01 // BufferFlagWavetable causes the buffer to be written in wavetable // format when using the Gen method, so that it can be used by // interpolating oscillators BufferFlagWavetable = 0x02 // BufferFlagClear causes the buffer to be cleared before new // partials are written using the Gen method. Otherwise new partials // are summed with the existing contents of the buffer. BufferFlagClear = 0x04 // BufferRoutineSine1 generates a buffer with a series of sine partials. // The args of this routine are the amplitudes of the partials. BufferRoutineSine1 = "sine1" // BufferRoutineSine2 is similar to BufferRoutineSine1 except that the // args are pairs of frequency and amplitude (i.e. you can specify the // frequency of each partial). BufferRoutineSine2 = "sine2" // BufferRoutineSine3 is similar to BufferRoutineSine1 except that the // args are triplets of frequency, amplitude, and phase (i.e. you can // specify the frequency and phase of each partial). BufferRoutineSine3 = "sine3" // 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. // To eliminate DC offset when used as a waveshaper, the wavetable is // offset so that the center value is zero. BufferRoutineCheby = "cheby" )
const ( DumpOff = 0 DumpParsed = 1 DumpContents = 2 DumpAll = 3 )
Arguments to dumpOSC command. See http://doc.sccode.org/Reference/Server-Command-Reference.html#/dumpOSC
const ( AddToHead = int32(0) AddToTail = int32(1) AddBefore = int32(2) AddAfter = int32(3) AddReplace = int32(4) )
Arguments to s_new command. See http://doc.sccode.org/Reference/Server-Command-Reference.html#/s_new
const ( // RootNodeID is what sclang uses as the root node ID. See http://doc.sccode.org/Classes/RootNode.html. RootNodeID = int32(0) // DefaultGroupID is what sclang uses for the default group ID. See http://doc.sccode.org/Reference/default_group.html. DefaultGroupID = int32(1) // DefaultLocalAddr is the listening address for DefaultClient. DefaultLocalAddr = "0.0.0.0:57110" // DefaultScsynthAddr is the remote address for DefaultClient. DefaultScsynthAddr = "0.0.0.0:57120" // DefaultConnectTimeout is the default timeout for connecting to scsynth. DefaultConnectTimeout = time.Second )
const ( // CurveStep is a flat envelope segment. CurveStep = C(0) // CurveLinear is a linear envelope segment. CurveLinear = C(1) // CurveExp is an exponential envelope segment. CurveExp = C(2) // CurveSine is a sinusoidal shaped envelope segment. CurveSine = C(3) // CurveWelch is a sinusoidal segment shaped like the sides of a welch window. CurveWelch = C(4) // CurveCustom is an undocumented (on doc.sccode.org) envelope segment shape. CurveCustom = C(5) // CurveSquared is a squared envelope segment. CurveSquared = C(6) // CurveCubed is a cubed envelope segment. CurveCubed = C(7) )
const ( GrainBufHanningEnv = -1 GrainBufNoInterp = 1 GrainBufLinearInterp = 2 GrainBufCubicInterp = 4 )
Envelope shapes for grain amp envelope.
const ( BinOpAbsdif = 38 BinOpAdd = 0 BinOpAmclip = 40 BinOpAtan2 = 22 BinOpClip2 = 42 BinOpDifsqr = 34 BinOpDiv = 4 BinOpExcess = 43 BinOpExpon = 25 BinOpFold2 = 44 BinOpGCD = 18 BinOpGT = 9 BinOpGTE = 11 BinOpHypot = 23 BinOpHypotApx = 24 BinOpLCM = 17 BinOpLT = 8 BinOpLTE = 10 BinOpMax = 13 BinOpModulo = 5 BinOpMin = 12 BinOpMul = 2 BinOpPow = 25 BinOpRing1 = 30 BinOpRing2 = 31 BinOpRing3 = 32 BinOpRing4 = 33 BinOpRound = 19 BinOpScaleneg = 41 BinOpSqrdif = 37 BinOpSqrsum = 36 BinOpSumsqr = 35 BinOpThresh = 39 BinOpTrunc = 21 BinOpWrap2 = 45 UnaryOpAbs = 5 UnaryOpAcos = 32 UnaryOpAmpDb = 22 UnaryOpAsin = 31 UnaryOpAtan = 33 UnaryOpBilinrand = 40 UnaryOpCeil = 8 UnaryOpCoin = 44 UnaryOpCos = 29 UnaryOpCosh = 35 UnaryOpCpsmidi = 18 UnaryOpCpsoct = 24 UnaryOpCubed = 13 UnaryOpDbAmp = 21 UnaryOpDistort = 42 UnaryOpExp = 15 UnaryOpFloor = 9 UnaryOpFrac = 10 UnaryOpLinrand = 39 UnaryOpLog = 25 UnaryOpLog10 = 27 UnaryOpLog2 = 26 UnaryOpMidicps = 17 UnaryOpMidiratio = 19 UnaryOpNeg = 0 UnaryOpOctcps = 23 UnaryOpRatiomidi = 20 UnaryOpRand = 37 UnaryOpRand2 = 38 UnaryOpReciprocal = 16 UnaryOpSoftClip = 43 UnaryOpSign = 11 UnaryOpSin = 28 UnaryOpSinh = 34 UnaryOpSquared = 12 UnaryOpSqrt = 14 UnaryOpSum3rand = 41 UnaryOpTan = 30 UnaryOpTanh = 36 )
Operator constants. These are used as the "special index" for BinaryOpUGen and UnaryOpUGen in synthdef files.
const ( BinOpUgenName = "BinaryOpUGen" UnaryOpUgenName = "UnaryOpUGen" )
Ugen names.
const ( IR = 0 KR = 1 AR = 2 )
Ugen rates.
- IR is initialization rate.
- KR is control rate.
- AR is audio rate.
See http://doc.sccode.org/Tutorials/Mark_Polishook_tutorial/08_Rates.html.
const ( DoNothing = iota Pause FreeEnclosing FreePreceding FreeFollowing FreePrecedingGroup FreeFollowingGroup FreeAllPreceding FreeAllFollowing FreeAndPausePreceding FreeAndPauseFollowing DeepFreePreceding DeepFreeFollowing FreeAllInGroup )
UGen done actions, see http://doc.sccode.org/Reference/UGen-doneActions.html
const DefaultServerPort = 57120
DefaultServerPort is the default listening port for scsynth.
const GrainBufDefaultMaxGrains = 512
GrainBufDefaultMaxGrains is the default value of MaxGrains.
const Pi = C(float32(math.Pi))
Pi is a wrapper around math.Pi
const ServerPath = "/usr/bin/scsynth:/usr/local/bin/scsynth"
ServerPath is the path the scsynth executable on linux systems.
Variables ¶
var ( DistLinear = C(0) DistCauchy = C(1) DistLogist = C(2) DistHyperbCos = C(3) DistArcSine = C(4) DistExpon = C(5) DistSinus = C(6) )
Probability distributions for Gendy1.
var ( WarpExp = C(1) WarpLin = C(0) )
Warp constants.
var ErrNoScsynth = errors.New("please install scsynth somewhere in your PATH")
ErrNoScsynth happens when you try to start a SuperCollider server but do not have an scsynth executable in your PATH.
var (
ErrTimeout = errors.New("timeout error")
)
Common errors.
var Synthdefs = map[string]*Synthdef{}
Synthdefs is a map of synthdefs.
Functions ¶
func Play ¶
Play corresponds to http://doc.sccode.org/Classes/Function.html#-play. It wraps the provided UgenFunc in a synthdef, sends this synthdef to a server instance with DefaultClient, then creates a new synth from the synthdef.
func RegisterSynthdef ¶ added in v0.1.4
RegisterSynthdef registers a synthdef with this package. It returns an error if a synthdef is already registered with the provided name.
Types ¶
type Allpass ¶ added in v0.1.4
type Allpass struct { // Interpolation determines the type of interpolation (e.g. none, linear, cubic). Interpolation Interpolation // In is the input signal In Input // MaxDelayTime is maximum delay time in seconds. // This is used to initialize the delay buffer. MaxDelayTime Input // DelayTime time in seconds DelayTime Input // DecayTime time for the echoes to decay by 60dB. // If this is negative then the feedback coefficient will // be negative, thus emphasizing only odd harmonics // at a lower octave. DecayTime Input }
Allpass is an allpass delay.
type AnalogIn ¶ added in v0.1.6
type AnalogIn struct { // Analog pin number to read. // Pin numbers begin at 0. // This value can be modulated at audiorate. AnalogPin Input }
Read data from an analog input. Note: This UGen only works on Bela: https://bela.io/
type AnalogOut ¶ added in v0.1.7
type AnalogOut struct { // Analog pin number to read. // Pin numbers begin at 0. // This value can be modulated at audiorate. AnalogPin Input // Value to write out to the pin. Output Input }
Write data to an analog output. Note: This UGen only works on Bela: https://bela.io/
type ArraySpec ¶ added in v0.1.4
type ArraySpec [3][]Input
ArraySpec is a convenience type for Klang and Klank.
func (ArraySpec) Absdif ¶ added in v0.1.4
Absdif returns the absolute value of the difference of two inputs.
func (ArraySpec) Bilinrand ¶ added in v0.1.4
Bilinrand returns a linearly distributed random value between [+in ... -in].
func (ArraySpec) Coin ¶ added in v0.1.4
Coin returns one or zero with the probability given by the input.
func (ArraySpec) Excess ¶ added in v0.1.4
Excess returns the difference of the original signal and its clipped form: (a - clip2(a,b)).
func (ArraySpec) Hypot ¶ added in v0.1.4
Hypot returns the square root of the sum of the squares of a and b. Or equivalently, the distance from the origin to the point (x, y).
func (ArraySpec) HypotApx ¶ added in v0.1.4
HypotApx returns an approximation of the square root of the sum of the squares of x and y.
func (ArraySpec) LCM ¶ added in v0.1.4
LCM computes the least common multiple of one Input and another.
func (ArraySpec) Linrand ¶ added in v0.1.4
Linrand returns a linearly distributed random value between in and zero.
func (ArraySpec) Midicps ¶ added in v0.1.4
Midicps converts from MIDI note values to cycles per second.
func (ArraySpec) Midiratio ¶ added in v0.1.4
Midiratio converts an interval in MIDI notes into a frequency ratio.
func (ArraySpec) Moddif ¶ added in v0.1.4
Moddif returns the smaller of the great circle distances between the two points.
func (ArraySpec) Rand ¶ added in v0.1.4
Rand returns an evenly distributed random value between this and zero.
func (ArraySpec) Rand2 ¶ added in v0.1.4
Rand2 returns an evenly distributed random value between [+this ... - this].
func (ArraySpec) Ratiomidi ¶ added in v0.1.4
Ratiomidi converts a frequency ratio to an interval in MIDI notes.
func (ArraySpec) Reciprocal ¶ added in v0.1.4
Reciprocal computes the reciprocal of a signal.
func (ArraySpec) Round ¶ added in v0.1.4
Round performs quantization by rounding. Rounds a to the nearest multiple of b.
func (ArraySpec) Sqrdif ¶ added in v0.1.4
Sqrdif computes the square of the difference between the two inputs.
func (ArraySpec) Sum3rand ¶ added in v0.1.4
Sum3rand returns a value from a gaussian-like random distribution between in and zero.
type BAllPass ¶ added in v0.1.4
type BAllPass struct { // In is the input signal. In Input // Freq is the center frequency. // WARNING: due to the nature of its implementation frequency values close to 0 // may cause glitches and/or extremely loud audio artifacts! Freq Input // RQ is the reciprocal of Q. bandwidth / cutoffFreq. RQ Input }
BAllPass is an allpass filter based on the Second Order Section (SOS) biquad UGen. NOTE: Biquad coefficient calculations imply certain amount of CPU overhead. These plugin UGens contain optimizations such that the coefficients get updated only when there has been a change to one of the filter's parameters. This can cause spikes in CPU performance and should be considered when using several of these units.
type BLowPass ¶
type BLowPass struct { // In is the input signal. In Input // Freq is frequency in Hz. Freq Input // RQ is the reciprocal of Q, bandwidth / cutoff. RQ Input }
BLowPass is a lowpass filter based on the Second Order Section biquad UGen.
type BPF ¶
type BPF struct { // In is the input signal In Input // Freq cutoff in Hz Freq Input // RQ Reciprocal of Q RQ Input }
BPF a resonant low pass filter
type BRF ¶
type BRF struct { // In is the input signal In Input // Freq cutoff in Hz Freq Input // RQ Reciprocal of Q RQ Input }
BRF a second order band reject filter
type Balance2 ¶
type Balance2 struct { // L is the left input signal L Input // R is the right input signal R Input // Pos stereo position where -1 is hard left and +1 is hard right Pos Input // Level gain [0, 1] Level Input }
Balance2 equal power panner
type Ball ¶ added in v0.1.4
Ball models the path of a bouncing object that is reflected by a vibrating surface.
type BrownNoise ¶
type BrownNoise struct{}
BrownNoise generates noise whose spectrum falls off in power by 6 dB per octave
func (BrownNoise) Rate ¶
func (brown BrownNoise) Rate(rate int8) Input
Rate creates a new ugen at a specific rate. If rate is an unsupported value this method will cause a runtime panic.
type Buffer ¶
type Buffer struct { Channels int32 Frames int32 Num int32 SampleRate float32 // contains filtered or unexported fields }
Buffer is a client-side representation of an scsynth audio buffer
type C ¶
type C float32
C wraps a float32 and implements the Input interface.
func (C) Absdif ¶ added in v0.1.4
Absdif returns the absolute value of the difference of two inputs.
func (C) Bilinrand ¶ added in v0.1.4
Bilinrand returns a linearly distributed random value between [+in ... -in].
func (C) Excess ¶ added in v0.1.4
Excess returns the difference of the original signal and its clipped form: (a - clip2(a,b)).
func (C) Expon ¶ added in v0.1.4
Expon raises a constant to the power of another input. If val is not a C the this method just returns c. TODO: fix this
func (C) Hypot ¶ added in v0.1.4
Hypot returns the square root of the sum of the squares of a and b. Or equivalently, the distance from the origin to the point (x, y).
func (C) HypotApx ¶ added in v0.1.4
HypotApx returns an approximation of the square root of the sum of the squares of x and y. This uses the formula:
abs(x) + abs(y) - ((sqrt(2) - 1) * min(abs(x), abs(y)))
func (C) Linrand ¶ added in v0.1.4
Linrand returns a linearly distributed random value between in and zero.
func (C) Midiratio ¶ added in v0.1.4
Midiratio converts an interval in MIDI notes into a frequency ratio.
func (C) Moddif ¶ added in v0.1.4
Moddif returns the smaller of the great circle distances between the two points.
func (C) Modulo ¶ added in v0.1.4
Modulo computes the modulo of one signal and another. If val is not a C, then this method just returns the receiver. I'm not sure what a constant modulo a ugen should be. Note that Go only supports integers for the modulo operator.
func (C) Pow ¶ added in v0.1.4
Pow raises a constant to the power of another input. If val is not a C the this method just returns c. TODO: fix this
func (C) Rand ¶ added in v0.1.4
Rand returns an evenly distributed random value between this and zero.
func (C) Rand2 ¶ added in v0.1.4
Rand2 returns an evenly distributed random value between [+this ... - this].
func (C) Ratiomidi ¶ added in v0.1.4
Ratiomidi converts a frequency ratio to an interval in MIDI notes.
func (C) Reciprocal ¶ added in v0.1.4
Reciprocal computes the reciprocal of a signal.
func (C) Round ¶ added in v0.1.4
Round performs quantization by rounding. Rounds a to the nearest multiple of b.
func (C) Sqrdif ¶ added in v0.1.4
Sqrdif computes the square of the difference between the two inputs.
func (C) Sum3rand ¶ added in v0.1.4
Sum3rand returns a value from a gaussian-like random distribution between in and zero.
type COsc ¶
type COsc struct { // BufNum the number of a buffer filled in wavetable format BufNum Input // Freq frequency in Hz Freq Input // Beats beat frequency in Hz Beats Input }
COsc is a chorusing wavetable lookup oscillator. Produces sum of 2 signals at
freq +- (beats / 2)
Due to summing, the peak amplitude is twice that of the wavetable.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client manages all communication with scsynth
func DefaultClient ¶
DefaultClient returns the default sc client.
func NewClient ¶
NewClient creates a new SuperCollider client. The client will bind to the provided address and port to receive messages from scsynth.
func (*Client) AddDefaultGroup ¶
AddDefaultGroup adds the default group.
func (*Client) AllocBuffer ¶
AllocBuffer allocates a buffer on the server
func (*Client) DumpOSC ¶
DumpOSC sends a /dumpOSC message to scsynth level should be DumpOff, DumpParsed, DumpContents, DumpAll
func (*Client) NextSynthID ¶
NextSynthID gets the next available ID for creating a synth
func (*Client) NodeFree ¶ added in v0.1.4
NodeFree stops a node abruptly, removes it from its group, and frees its memory. Using this method can cause a click if the node is not silent at the time it is freed.
func (*Client) NodeMap ¶ added in v0.1.4
NodeMap causes controls of a node to be read from a control bus. The first argument is the node ID. The second argument is a map from control names to control bus indices.
func (*Client) NodeMapa ¶ added in v0.1.4
NodeMapa causes controls of a node to be read from an audio bus. The first argument is the node ID. The second argument is a map from control names to audio bus indices.
func (*Client) QueryBuffer ¶ added in v0.1.4
QueryBuffer gets information about a buffer from scsynth.
func (*Client) QueryGroup ¶
QueryGroup g_queryTree for a particular group.
func (*Client) ReadBuffer ¶
ReadBuffer tells the server to read an audio file and load it into a buffer.
func (*Client) SendAllDefs ¶ added in v0.1.4
SendAllDefs sends all the synthdefs that have been registered with RegisterSynthdef.
func (*Client) SendDef ¶
SendDef sends a synthdef to scsynth. This method blocks until a /done message is received indicating that the synthdef was loaded
func (*Client) Status ¶
func (c *Client) Status(timeout time.Duration) (*ServerStatus, error)
Status gets the status of scsynth with a timeout. If the status request times out it returns ErrTimeout.
type ClipNoise ¶
type ClipNoise struct{}
ClipNoise generates noise whose values are either -1 or 1. This produces the maximum energy for the least peak to peak amplitude.
type CoinGate ¶ added in v0.1.4
type CoinGate struct { // Value between 0.0 and 1.0 determines probability of either possibilities. Prob Input // Trigger signal. In Input }
CoinGate tosses a coin every time it receives a trigger and either passes the trigger or doesn't.
type Comb ¶
type Comb struct { // Interpolation determines the type of interpolation. Interpolation Interpolation // In the input signal In Input // MaxDelayTime maximum delay time in seconds, which is used // to initialize the delay buffer size. MaxDelayTime Input // DelayTime delay time in seconds DelayTime Input // DecayTime time for the echoes to decay by 60dB. // If this time is negative then the feedback coefficient will be // negative, thus emphasizing only odd harmonics an octave lower. DecayTime Input }
Comb is a delay line with cubic interpolation.
type ControlRate ¶ added in v0.1.4
type ControlRate struct{}
ControlRate returns the current control rate of the server.
func (ControlRate) Rate ¶ added in v0.1.4
func (s ControlRate) Rate(rate int8) Input
Rate creates a new ugen at a specific rate. If rate is not IR this method will cause a runtime panic.
type Crackle ¶
type Crackle struct {
Chaos Input
}
Crackle is a noise generator based on a chaotic function.
type Decay ¶
type Decay struct { // In is the input signal In Input // Decay 60dB decay time in seconds Decay Input }
Decay is an exponential decay.
type Decay2 ¶
type Decay2 struct { // In is the input signal In Input // Attack 60dB attack time in seconds Attack Input // Decay 60dB decay time in seconds Decay Input }
Decay2 is just like Decay, except it rounds off the attack by subtracting one Decay from another. This fixes the sharp attacks and clicks that can sometimes occur with Decay.
type DecodeB2 ¶ added in v0.1.4
type DecodeB2 struct { // NumChans is the number of output speakers. Typically 4 to 8. NumChans int // The B-format signal. // This should be a ugen with 3 outputs: W, X, and Y. In Input // Orientation should be zero if the front is a vertex of the polygon. // The first speaker will be directly in front. // Should be 0.5 if the front bisects a side of the polygon. // Then the first speaker will be the one left of center. Orientation Input }
DecodeB2 Decodes a two dimensional ambisonic B-format signal to a set of speakers in a regular polygon. The outputs will be in clockwise order. The position of the first speaker is either center or left of center.
type Delay ¶
type Delay struct { // Interpolation determines the type of interpolation. Interpolation Interpolation // In the input signal In Input // MaxDelayTime maximum delay time in seconds, which is used // to initialize the delay buffer size. MaxDelayTime Input // DelayTime delay time in seconds DelayTime Input }
Delay is a simple delay line.
type DetectSilence ¶ added in v0.1.3
type DetectSilence struct { In Input // The input signal. Amp Input // Amplitude threshold. Time Input // The minimum duration for which amplitude must be below Amp before Done triggers. Done int // UGen done-action. }
DetectSilence evaluates Done when input falls below a certain threshold.
func (DetectSilence) Rate ¶ added in v0.1.3
func (ds DetectSilence) Rate(rate int8) Input
Rate creates a new ugen at a specific rate. If rate is an unsupported value this method will cause a runtime panic.
type DigitalIn ¶ added in v0.1.7
type DigitalIn struct { // Digital pin number to read. // Pin numbers begin at 0. // This value cannot be modulated. DigitalPin Input }
Read digital data from a digital sensor input. Note: This UGen only works on Bela: https://bela.io/
type DigitalOut ¶ added in v0.1.7
type DigitalOut struct { // Digital pin number to write to. // Pin numbers begin at 0. // This value cannot be modulated. DigitalPin Input // Value to write out to the pin. The value will be 1 when the argument is larger // than 0, otherwise 0. Output Input }
Write data to a digital output. Note: This UGen only works on Bela: https://bela.io/ Note: If you want to modulate the pin number, you should use the UGen DigitalIO
func (DigitalOut) Rate ¶ added in v0.1.7
func (d DigitalOut) Rate(rate int8) Input
Rate returns an Input at the specified rate. This method panics if rate is not a supported value.
type Dust ¶
type Dust struct { // Density is the average number of impulses per second Density Input }
Dust generates random impulses from 0 to +1
type Dust2 ¶
type Dust2 struct { // Density is the average number of impulses per second Density Input }
Dust2 generates random impulses from -1 to +1
type Env ¶
type Env struct { // Levels is the array of levels Levels []Input // Times is the array of durations (in seconds). // The length of this array should be one less than the // Levels array. Times []Input // Curve determines the shape of each envelope segment. // This could be a string, a float, a slice of strings, or a slice of floats. Curve interface{} ReleaseNode Input LoopNode Input }
Env is a specification for a breakpoint envelope
type EnvADSR ¶
type EnvADSR struct {
A, D, S, R, Peak, Curve, Bias Input
}
EnvADSR represents the ever-popular ADSR envelope
type EnvASR ¶
type EnvASR struct {
A, S, R, Curve Input
}
EnvASR is an attack-sustain-release envelope
type EnvCutoff ¶
type EnvCutoff struct {
R, Level, CurveType Input
}
EnvCutoff creates an envelope with no attack segment. It simply sustains at the peak level until released.
type EnvDADSR ¶
type EnvDADSR struct {
Delay, A, D, S, R, Peak, Curve, Bias Input
}
EnvDADSR is EnvADSR with its onset delayed by D seconds
type EnvGen ¶
type EnvGen struct { // Env determines the shape of the envelope Env Envelope // Gate triggers the envelope and holds it open while > 0 Gate Input // LevelScale scales the levels of the breakpoints LevelScale Input // LevelBias offsets the levels of the breakpoints LevelBias Input // TimeScale scales the durations of the segments TimeScale Input // Done is the ugen done action Done int }
EnvGen plays back breakpoint envelopes. The envelopes must implement the Envelope interface. The envelope and the arguments for LevelScale, LevelBias, and TimeScale are polled when the EnvGen is triggered and remain constant for the duration of the envelope.
type EnvLinen ¶
type EnvLinen struct {
Attack, Sustain, Release, Level Input
Curve interface{}
}
EnvLinen creates a new envelope which has a trapezoidal shape
type EnvPairs ¶
type EnvPairs struct { Pairs Pairs Curve interface{} }
EnvPairs creates a new envelope from coordinates/pairs
type EnvPerc ¶
type EnvPerc struct {
Attack, Release, Level, Curve Input
}
EnvPerc creates a new envelope that has a percussive shape
type EnvSine ¶
type EnvSine struct {
Dur, Level Input
}
EnvSine creates a new envelope which has a hanning window shape
type EnvTLC ¶
type EnvTLC []TLC
EnvTLC creates a new envelope from an array of (time, level, curve) triplets This is renamed from Env.xyc. The Curve value of the last triplet is ignored.
type EnvTriangle ¶
type EnvTriangle struct {
Dur, Level Input
}
EnvTriangle creates a new envelope that has a triangle shape
func (EnvTriangle) Inputs ¶
func (tri EnvTriangle) Inputs() []Input
Inputs returns the array of inputs that defines the Env.
type Envelope ¶
type Envelope interface { // InputsArray provides EnvGen with the data it needs // to get a list of inputs. Inputs() []Input }
Envelope is an interface that should be implemented by types that define envelopes for EnvGen.
type FFT ¶ added in v0.1.4
type FFT struct { // A buffer to store spectral data. The buffer's size must correspond to a power of 2. // LocalBuf is useful here, because processes should not share data between synths. // (Note: most PV UGens operate on this data in place. Use PV_Copy for parallel processing.) Buffer Input // The signal to be analyzed. The signal's rate determines the rate at which the input is read. In Input // The amount of offset from the beginning of one FFT analysis frame to the next, measured in multiples of the analysis frame size. // This can range between 1.0 and values close to (but larger than) 0.0, // and the default is 0.5 (meaning each frame has a 50% overlap with the preceding/following frames). Hop Input // Defines how the data is windowed: // -1 is rectangular windowing, simple but typically not recommended // 0 is (the default) Sine windowing, typically recommended for phase-vocoder work // 1 is Hann windowing, typically recommended for analysis work. WinType Input // A simple control allowing FFT analysis to be active (>0) or inactive (<=0). // This is mainly useful for signal analysis processes which are only intended to analyse at specific times rather than continuously Active Input // The windowed audio frames are usually the same size as the buffer. // If you wish the FFT to be zero-padded then you can specify a window size smaller than the actual buffer size // (e.g. window size 1024 with buffer size 2048). // Both values must still be a power of two. Leave this at its default of zero for no zero-padding. WinSize Input }
FFT implements the Fast Fourier Transform. The fast fourier transform analyzes the frequency content of a signal, which can be useful for audio analysis or for frequency-domain sound processing (phase vocoder).
type FSinOsc ¶
type FSinOsc struct { // Freq is frequency in Hz Freq Input // Phase is the initial phase offset Phase Input }
FSinOsc is a very fast sine wave generator implemented using a ringing filter. This generates a much cleaner sine wave than a table lookup oscillator and is a lot faster. However, the amplitude of the wave will vary with frequency. Generally the amplitude will go down as you raise the frequency and go up as you lower the frequency.
type Formant ¶ added in v0.1.4
type Formant struct { // FundFreq is the fundamental frequency in Hertz. (control rate) FundFreq Input // FormantFreq is the formant frequency in Hertz. (control rate) FormantFreq Input // BWFreq is the pulse width frequency in Hertz. // Controls the bandwidth of the formant. (control rate) // Must be greater than or equal to fundfreq. BWFreq Input }
Formant generates a set of harmonics around a formant frequency at a given fundamental frequency. The frequency inputs are read at control rate only, so if you use an audio rate UGen as an input, it will only be sampled at the start of each audio synthesis block.
type Formlet ¶
type Formlet struct { // In the input signal In Input // Freq resonant frequency in Hz Freq Input // AttackTime 60 dB attack time in seconds AttackTime Input // DecayTime 60 dB decay time in seconds DecayTime Input }
Formlet is a resonant filter whose impulse response is like that of a sine wave with a Decay2 envelope over it. The great advantage to this filter over FOF is that there is no limit to the number of overlapping grains since the grain is just the impulse response of the filter.
type FreeVerb ¶
type FreeVerb struct { // In the input signal In Input // Mix dry/wet balance [0, 1] Mix Input // Room room size [0, 1] Room Input // Damp high frequency damping [0, 1] Damp Input }
FreeVerb reverb implemented with faust
type GVerb ¶ added in v0.1.4
type GVerb struct { // Mono Input In Input // In squared meters RoomSize Input // In seconds RevTime Input // 0 to 1, high frequency rolloff, 0 damps the reverb signal completely, 1 not at all Damping Input // 0 to 1, same as damping control, but on the input signal. InputBW Input // A control on the stereo spread and diffusion of the reverb signal. Spread Input // Amount of dry signal. DryLevel Input // Amount of early reflection level. EarlyRefLevel Input // Amount of tail level. TailLevel Input // To set the size of the delay lines. Defaults to roomsize + 1. MaxRoomSize Input }
GVerb is a two-channel reverb UGen. Based on the "GVerb" LADSPA effect by Juhana Sadeharju (kouhia at nic.funet.fi).
type Gate ¶
type Gate struct { // In is the input signal. In Input // Trig is the rigger signal. The output is held fixed when this is non-positive. Trig Input }
Gate allows an input signal value to pass when gate is positive, otherwise holds last value.
type Gendy1 ¶ added in v0.1.4
type Gendy1 struct { // Choice of probability distribution for the next perturbation // of the amplitude of a control point. AmpDist Input // Choice of distribution for the perturbation of the current inter control point duration. DurDist Input // A parameter for the shape of the amplitude probability distribution, // requires values in the range 0.0001 to 1 (there are safety checks // in the code so don't worry too much if you want to modulate!). ADParam Input // A parameter for the shape of the duration probability distribution, // requires values in the range 0.0001 to 1. DDParam Input // Minimum allowed frequency of oscillation for the Gendy1 oscillator, // so gives the largest period the duration is allowed to take on. MinFreq Input // Maximum allowed frequency of oscillation for the Gendy1 oscillator, // so gives the smallest period the duration is allowed to take on. MaxFreq Input // Normally 0.0 to 1.0, multiplier for the distribution's delta value for amplitude. // An ampscale of 1.0 allows the full range of -1 to 1 for a change of amplitude. AmpScale Input // Normally 0.0 to 1.0, multiplier for the distribution's delta value for duration. // An ampscale of 1.0 allows the full range of -1 to 1 for a change of duration. DurScale Input // Initialise the number of control points in the memory. // Xenakis specifies 12. // There would be this number of control points per cycle of the oscillator, // though the oscillator's period will constantly change due to the duration distribution. InitCPs Input // Current number of utilised control points, allows modulation. KNum Input // contains filtered or unexported fields }
Gendy1 is an implementation of the dynamic stochastic synthesis generator conceived by Iannis Xenakis and described in Formalized Music (1992, Stuyvesant, NY: Pendragon Press) chapter 9 (pp 246-254) and chapters 13 and 14 (pp 289-322). The BASIC program in the book was written by Marie-Helene Serra so I think it helpful to credit her too. The program code has been adapted to avoid infinities in the probability distribution functions. The distributions are hard-coded in C but there is an option to have new amplitude or time breakpoints sampled from a continuous controller input. All parameters can be modulated at control rate except for initCPs which is used only at initialisation.
type Gendy2 ¶ added in v0.1.4
type Gendy2 struct { Gendy1 // Parameter for Lehmer random number generator perturbed by Xenakis as in ((old*a)+c)%1.0 A Input // Parameter for Lehmer random number generator perturbed by Xenakis. C Input }
Gendy2 is a dynamic stochastic synthesis generator. See Gendy1 for background. This variant of GENDYN is closer to that presented in Hoffmann, Peter. (2000) The New GENDYN Program. Computer Music Journal 24:2, pp 31-38.
type Gendy3 ¶ added in v0.1.4
type Gendy3 struct { // Choice of probability distribution for the next perturbation // of the amplitude of a control point. AmpDist Input // Choice of distribution for the perturbation of the current inter control point duration. DurDist Input // A parameter for the shape of the amplitude probability distribution, // requires values in the range 0.0001 to 1 (there are safety checks // in the code so don't worry too much if you want to modulate!). ADParam Input // A parameter for the shape of the duration probability distribution, // requires values in the range 0.0001 to 1. DDParam Input // Oscillation frquency. Freq Input // Normally 0.0 to 1.0, multiplier for the distribution's delta value for amplitude. // An ampscale of 1.0 allows the full range of -1 to 1 for a change of amplitude. AmpScale Input // Normally 0.0 to 1.0, multiplier for the distribution's delta value for duration. // An ampscale of 1.0 allows the full range of -1 to 1 for a change of duration. DurScale Input // Initialise the number of control points in the memory. // Xenakis specifies 12. // There would be this number of control points per cycle of the oscillator, // though the oscillator's period will constantly change due to the duration distribution. InitCPs Input // Current number of utilised control points, allows modulation. KNum Input }
Gendy3 is a dynamic stochastic synthesis generator. See Gendy1 for background. This variant of GENDYN normalises the durations in each period to force oscillation at the desired pitch. The breakpoints still get perturbed as in Gendy1. There is some glitching in the oscillator caused by the stochastic effects: control points as they vary cause big local jumps of amplitude. Put ampscale and durscalelow to minimise the rate of this.
type GrainBuf ¶
type GrainBuf struct { // NumChannels is the number of channels to output. // If 1, mono is returned and pan is ignored. NumChannels int // Trigger is a KR or AR trigger to start a new grain. // If AR, grains after the start of the synth are // sample-accurate. Trigger Input // Dur is the size of the grain in seconds. Dur Input // BufNum is the buffer holding a mono audio signal. BufNum Input // Speed is the playback speed of the grain. Speed Input // Pos is the position in the audio buffer where // the grain will start. This is in the range [0, 1]. Pos Input // Interp is the interpolation method used for // pitch-shifting grains. // GrainBufNoInterp is no interpolation, // GrainBufLinearInterp is linear, // and GrainBufCubicInterp is cubic. Interp Input // Pan determines where to position the output in a stereo // field. If NumChannels = 1, no panning is done. If // NumChannels = 2, behavior is similar to Pan2. If // NumChannels > 2, behavior is the same as PanAz. Pan Input // EnvBuf is the buffer number containing a signal to use // for each grain's amplitude envelope. If set to // GrainBufHanningEnv, a built-in Hanning envelope is used. EnvBuf Input // MaxGrains is the maximum number of overlapping grains // that can be used at a given time. This value is set // when you initialize GrainBuf and can't be modified. // Default is 512, but lower values may result in more // efficient use of memory. MaxGrains Input }
GrainBuf is a table-lookup sinewave oscillator
type GrainFM ¶
type GrainFM struct { // NumChannels is the number of channels to output. // If 1, mono is returned and pan is ignored. NumChannels int // Trigger is a KR or AR trigger to start a new grain. // If AR, grains after the start of the synth are // sample-accurate. Trigger Input // Dur is the size of the grain (in seconds) Dur Input // CarFreq the carrier frequency of the grain generator's internal oscillator CarFreq Input // ModFreq the modulator frequency of the grain generator's internal oscillator ModFreq Input // ModIndex the index of modulation ModIndex Input // Pan determines where to position the output in a stereo // field. If NumChannels = 1, no panning is done. If // NumChannels = 2, behavior is similar to Pan2. If // NumChannels > 2, behavior is the same as PanAz. Pan Input // EnvBuf is the buffer number containing a signal to use // for each grain's amplitude envelope. If set to // GrainBufHanningEnv, a built-in Hanning envelope is used. EnvBuf Input // MaxGrains is the maximum number of overlapping grains // that can be used at a given time. This value is set // when you initialize GrainFM and can't be modified. // Default is 512, but lower values may result in more // efficient use of memory. MaxGrains Input }
GrainFM is a table-lookup sinewave oscillator
type GrainIn ¶ added in v0.1.4
type GrainIn struct { // NumChannels is the number of channels to output. // If 1, mono is returned and pan is ignored. NumChannels int // Trigger is a KR or AR trigger to start a new grain. // If AR, grains after the start of the synth are // sample-accurate. Trigger Input // Dur is the size of the grain in seconds. Dur Input // In is the input signal. In Input // Pan determines where to position the output in a stereo // field. If NumChannels = 1, no panning is done. If // NumChannels = 2, behavior is similar to Pan2. If // NumChannels > 2, behavior is the same as PanAz. Pan Input // EnvBuf is the buffer holding a mono audio signal. EnvBuf Input // MaxGrains is the maximum number of overlapping grains // that can be used at a given time. This value is set // when you initialize GrainBuf and can't be modified. // Default is 512, but lower values may result in more // efficient use of memory. MaxGrains Input }
GrainIn granulates an input signal.
type GrainSin ¶ added in v0.1.4
type GrainSin struct { // NumChannels is the number of channels to output. // If 1, mono is returned and pan is ignored. NumChannels int // Trigger is a KR or AR trigger to start a new grain. // If AR, grains after the start of the synth are // sample-accurate. Trigger Input // Dur is the size of the grain in seconds. Dur Input // Freq is the input to granulate. Freq Input // Pan determines where to position the output in a stereo // field. If NumChannels = 1, no panning is done. If // NumChannels = 2, behavior is similar to Pan2. If // NumChannels > 2, behavior is the same as PanAz. Pan Input // EnvBuf is the buffer holding a mono audio signal. EnvBuf Input // MaxGrains is the maximum number of overlapping grains // that can be used at a given time. This value is set // when you initialize GrainBuf and can't be modified. // Default is 512, but lower values may result in more // efficient use of memory. MaxGrains Input }
GrainSin implements granular synthesis with sine tones. All args except numChannels and trigger are polled at grain creation time.
type GrayNoise ¶
type GrayNoise struct { }
GrayNoise generates noise which results from flipping random bits in a word. This type of noise has a high RMS level relative to its peak to peak level. The spectrum is emphasized towards lower frequencies.
type GroupNode ¶ added in v0.1.4
type GroupNode struct { Children []Node // contains filtered or unexported fields }
GroupNode is a group of nodes.
func (*GroupNode) FreeAll ¶ added in v0.1.4
FreeAll frees all the nodes in a group recursively. TODO
type Hasher ¶ added in v0.1.4
type Hasher struct {
In Input
}
Hasher returns a unique output value from -1 to +1 for each input value according to a hash function. The same input value will always produce the same output value. The input need not be in the range -1 to +1.
type IFFT ¶ added in v0.1.4
type IFFT struct { // The FFT "chain" signal coming originally from an FFT UGen, // perhaps via other PV UGens. Buffer Input // WinType defines how the data is windowed: // -1 is rectangular windowing, simple but typically not recommended; // 0 (the default) is sine windowing, typically recommended for phase-vocoder work; // 1 is Hann windowing, typically recommended for analysis work. WinType Input // WinSize can be used to account for zero-padding, // in the same way as the FFT UGen. WinSize Input }
IFFT converts from frequency content to a signal. The fast fourier transform analyzes the frequency content of a signal. The IFFT UGen converts this frequency-domain information back into time-domain audio data. Most often this is used as the end of a process which begins with FFT, followed by frequency-domain processing using PV (phase-vocoder) UGens, followed by IFFT.
type Impulse ¶
type Impulse struct { // Freq frequency in Hz Freq Input // Phase offset in cycles [0, 1] Phase Input }
Impulse non-band-limited single-sample impulses
type Input ¶
type Input interface { // Abs computes the absolute value of a signal. Abs() Input // Absdif returns the absolute value of the difference of two inputs. Absdif(Input) Input // Acos computes the arccosine of a signal. Acos() Input // Amclip returns 0 when b <= 0, a*b when b > 0. Amclip(Input) Input // Asin computes the arcsine of a signal. Asin() Input // Atan computes the arctangent of a signal. Atan() Input // Atan2 returns the arctangent of y/x. Atan2(val Input) Input // Add adds one Input to another. Add(val Input) Input // AmpDb converts linear amplitude to decibels. AmpDb() Input // Bilinrand returns a linearly distributed random value between [+in ... -in]. Bilinrand() Input // Ceil computes the ceiling (next lowest integer) of a signal. Ceil() Input // Clip2 clips input wave a to +/- b Clip2(Input) Input // Coin returns one or zero with the probability given by the input. Coin() Input // Cos computes the cosine of an Input. Cos() Input // Cosh computes the hyperbolic cosine of an Input. Cosh() Input // Cpsmidi converts frequency in Hz to midi note values. Cpsmidi() Input // Cpsoct converts cycles per second to decimal octaves. Cpsoct() Input // Cubed raises a signal to the power of 3. Cubed() Input // DbAmp converts decibels to linear amplitude. DbAmp() Input // Difsqr returns the value of (a*a) - (b*b). Difsqr(Input) Input // Distort performs non-linear distortion on a signal. Distort() Input // Div divides one input by another. Div(Input) Input // Exp computes the exponential of a signal. Exp() Input // Expon raises this input to the power of another. // When used with UGens which produce a negative signal this function extends // the usual definition of exponentiation and returns neg(neg(a) ** b). // This allows exponentiation of negative signal values by noninteger exponents. // For the normal behaviour use Pow (see below). Expon(Input) Input // Excess returns the difference of the original signal and its clipped form: (a - clip2(a,b)). Excess(Input) Input // Floor computes the floor (next lowest integer) of a signal. Floor() Input // Fold2 folds input wave a to +/- b Fold2(Input) Input // Frac returns the fractional part of a signal. Frac() Input // GCD computes the gcd of one Input and another. GCD(Input) Input // GT computes x > y. GT(Input) Input // GT computes x >= y. GTE(Input) Input // Hypot returns the square root of the sum of the squares of a and b. // Or equivalently, the distance from the origin to the point (x, y). Hypot(Input) Input // HypotApx returns an approximation of the square root of the sum of the squares of x and y. HypotApx(Input) Input // LCM computes the least common multiple of one Input and another. LCM(Input) Input // LT computes x < y. LT(Input) Input // LT computes x <= y. LTE(Input) Input // Linrand returns a linearly distributed random value between in and zero. Linrand() Input // Log computes a natural logarithm. Log() Input // Log10 computes a base 10 logarithm. Log10() Input // Log2 computes a base 2 logarithm. Log2() Input // Max returns the max of one signal and another. Max(other Input) Input // Midicps converts MIDI note number to cycles per second. Midicps() Input // Midiratio converts an interval in MIDI notes into a frequency ratio. Midiratio() Input // Min returns the minimum of one signal and another. Min(Input) Input // Moddif returns the smaller of the great circle distances between the two points. Moddif(Input, Input) Input // Modulo computes the modulo of one signal and another. Modulo(Input) Input // Mul multiplies one Input by another. Mul(val Input) Input // MulAdd multiplies and adds an Input using two others. MulAdd(mul, add Input) Input // Neg is a convenience operator that multiplies a signal by -1. Neg() Input // Octcps converts decimal octaves to cycles per second. Octcps() Input // Pow raises an Input to the power of another. Pow(Input) Input // Rand returns an evenly distributed random value between this and zero. Rand() Input // Rand2 returns an evenly distributed random value between [+this ... - this]. Rand2() Input // Ratiomidi converts a frequency ratio to an interval in MIDI notes. Ratiomidi() Input // Reciprocal computes the reciprocal of a signal. Reciprocal() Input // Ring1 is ring modulation plus first source. Ring1(val Input) Input // Ring2 is ring modulation plus both sources. Ring2(val Input) Input // Ring3 returns the value of (a*a *b) Ring3(val Input) Input // Ring4 returns the value of ((a*a *b) - (a*b*b)). Ring4(val Input) Input // Round performs quantization by rounding. Rounds a to the nearest multiple of b. Round(Input) Input // Scaleneg returns a*b when a < 0, otherwise a. Scaleneg(Input) Input // Sign computes the sign of a signal. // This returns -1 when a < 0, +1 when a > 0, 0 when a is 0. Sign() Input // Sin computes the sine of an Input. Sin() Input // Sinh computes the hyperbolic sine of an Input. Sinh() Input // SoftClip distorts a signal with a perfectly linear range from -0.5 to 0.5 SoftClip() Input // Sqrdif computes the square of the difference between the two inputs. Sqrdif(Input) Input // Sqrsum computes the square of the sum of the two inputs. Sqrsum(Input) Input // Sqrt computes the square root of a signal. // The definition of square root is extended for signals so that sqrt(a) // when a < 0 returns -sqrt(-a). Sqrt() Input // Squared raises a signal to the power of 2. Squared() Input // Sum3rand returns a value from a gaussian-like random distribution between in and zero. Sum3rand() Input // Sumsqr returns the value of (a*a) + (b*b). Sumsqr(Input) Input // Tan computes the tangent of an Input. Tan() Input // Tanh computes the hyperbolic tangent of an Input. Tanh() Input // Thresh returns 0 when a < b, otherwise a. Thresh(Input) Input // Trunc performs quantization by truncation. Truncate a to a multiple of b. Trunc(Input) Input // Wrap2 wraps input wave to +/- b Wrap2(Input) Input }
Input is implemented by any value that can serve as a ugen input. This includes synthdef parameters, constants, and other ugens.
func Fill ¶ added in v0.1.4
Fill returns a slice of inputs that has length n and every element is set to input.
func NewInput ¶ added in v0.1.4
NewInput creates a ugen suitable for use as an input to other ugens. It will return either a single-channel ugen or a multi-channel ugen.
func RandArray ¶ added in v0.1.4
RandArray returns a slice (of length n) of random constants between min and max.
type Inputs ¶
type Inputs []Input
Inputs is a slice of Input.
func Multi ¶
Multi does multichannel expansion. See http://doc.sccode.org/Guides/Multichannel-Expansion.html.
func (Inputs) Absdif ¶ added in v0.1.4
Absdif returns the absolute value of the difference of two inputs.
func (Inputs) Bilinrand ¶ added in v0.1.4
Bilinrand returns a linearly distributed random value between [+in ... -in].
func (Inputs) Coin ¶ added in v0.1.4
Coin returns one or zero with the probability given by the input.
func (Inputs) Excess ¶ added in v0.1.4
Excess returns the difference of the original signal and its clipped form: (a - clip2(a,b)).
func (Inputs) Hypot ¶ added in v0.1.4
Hypot returns the square root of the sum of the squares of a and b. Or equivalently, the distance from the origin to the point (x, y).
func (Inputs) HypotApx ¶ added in v0.1.4
HypotApx returns an approximation of the square root of the sum of the squares of x and y.
func (Inputs) InputArray ¶
InputArray provides access to the list of inputs.
func (Inputs) Linrand ¶ added in v0.1.4
Linrand returns a linearly distributed random value between in and zero.
func (Inputs) Max ¶ added in v0.1.3
Max returns Inputs that contain the max of all the inputs and the provided Input.
func (Inputs) Midiratio ¶ added in v0.1.4
Midiratio converts an interval in MIDI notes into a frequency ratio.
func (Inputs) Moddif ¶ added in v0.1.4
Moddif returns the smaller of the great circle distances between the two points.
func (Inputs) Rand ¶ added in v0.1.4
Rand returns an evenly distributed random value between this and zero.
func (Inputs) Rand2 ¶ added in v0.1.4
Rand2 returns an evenly distributed random value between [+this ... - this].
func (Inputs) Ratiomidi ¶ added in v0.1.4
Ratiomidi converts a frequency ratio to an interval in MIDI notes.
func (Inputs) Reciprocal ¶ added in v0.1.4
Reciprocal computes the reciprocal of a signal.
func (Inputs) Round ¶ added in v0.1.4
Round performs quantization by rounding. Rounds a to the nearest multiple of b.
func (Inputs) Sqrdif ¶ added in v0.1.4
Sqrdif computes the square of the difference between the two inputs.
func (Inputs) Sum3rand ¶ added in v0.1.4
Sum3rand returns a value from a gaussian-like random distribution between in and zero.
type Integrator ¶
type Integrator struct { // In is the input signal In Input // Coef is the leak coefficient Coef Input }
Integrator integrates an input signal with a leak. The formula used is
out(0) = in(0) + (coef * out(-1))
func (Integrator) Rate ¶
func (integrator Integrator) Rate(rate int8) Input
Rate creates a new ugen at a specific rate. If an In signal is not provided this method will trigger a runtime panic.
type Interpolation ¶
type Interpolation int
Interpolation is a smoothing strategy for delay lines. Possible values are
- InterpolationNone
- InterpolationLinear
- InterpolationCubic
const ( InterpolationNone Interpolation = iota InterpolationLinear InterpolationCubic )
Interpolation types.
type JPverb ¶ added in v0.1.4
type JPverb struct { // In is the input signal. In Input // T60 is time for the reverb to decay 60db. // Does not effect early reflections. (0.1..60) T60 Input // Damp controls damping of high-frequencies as the reverb decays. // 0 is no damping, 1 is very strong damping (0..1) Damp Input // Size scales size of delay-lines within the reverberator, // producing the impression of a larger or smaller space. // Values below 1 can sound metallic. (0.5..5) Size Input // EarlyDiff controls shape of early reflections. // Values of 0.707 or more produce smooth exponential decay. // Lower values produce a slower build-up of echoes. (0..1) EarlyDiff Input // ModDepth is the depth of delay-line modulation. // Use in combination with ModFreq to set amount of chorusing // within the structure. (0..1) ModDepth Input // ModFreq is the frequency of delay-line modulation. // Use in combination with modDepth to set amount of chorusing // within the structure. (0..10) ModFreq Input // Low is the multiplier for the reverberation time within the low band. (0..1) Low Input // Mid is the multiplier for the reverberation time within the mid band. (0..1) Mid Input // High is the multiplier for the reverberation time within the high band. (0..1) High Input // LowCut is the frequency at which the crossover between // the low and mid bands of the reverb occurs. (100..6000) LowCut Input HighCut Input }
JPverb is a reverb effect from sc3-plugins. See https://github.com/supercollider/sc3-plugins and http://doc.sccode.org/Classes/JPverb.html
type Klang ¶ added in v0.1.4
type Klang struct { // Spec consists of 3 Input slices. // 1. frequencies: An Array of oscillator frequencies. // 2. amplitudes: A slice of oscillator amplitudes, or nil. If nil, then amplitudes default to 1.0. // 3. phases: A slice of initial phases, or nil. If nil, then phases default to 0.0. // The parameters in specificationsArrayRef can't be changed after it has been started. // For a modulatable but less efficient version, see DynKlang. Spec Input // A scale factor multiplied by all frequencies at initialization time. FreqScale Input // An offset added to all frequencies at initialization time. FreqOffset Input }
Klang is a bank of fixed frequency sine oscillators. Klang is more efficient than creating individual oscillators but offers less flexibility.
type Klank ¶ added in v0.1.3
type Klank struct { // In is the excitation input to the resonant filter bank. In Input // Spec is three Input slices (which should all have the same length). // The first slice is the filter frequencies. // The second slice is the filter amplitudes. // The third slice is the 60dB decay times in seconds for the filters. Spec Input // FreqScale is a scale factor multiplied by all frequencies at initialization time. FreqScale Input // FreqOffset is an offset added to all frequencies at initialization time. FreqOffset Input // DecayScale is a scale factor multiplied by all ring times at initialization time. DecayScale Input }
Klank is a bank of fixed frequency resonators which can be used to simulate the resonant modes of an object. Each mode is given a ring time, which is the time for the mode to decay by 60 dB.
type LFClipNoise ¶ added in v0.1.4
type LFClipNoise struct {
Freq Input
}
LFClipNoise randomly generates the values -1 or +1 at a rate given by the nearest integer division of the sample rate by the freqargument. It is probably pretty hard on your speakers!
func (LFClipNoise) Rate ¶ added in v0.1.4
func (l LFClipNoise) Rate(rate int8) Input
Rate creates a new ugen at a specific rate. If rate is an unsupported value this method will cause a runtime panic.
type LFCub ¶
type LFCub struct { // Freq frequency in Hz Freq Input // Iphase initial phase offset Iphase Input }
LFCub is a sine-like shape made of two cubic pieces. It is smoother than LFPar.
type LFDClipNoise ¶ added in v0.1.4
type LFDClipNoise struct {
Freq Input
}
LFDClipNoise is like LFClipNoise, except it generates the values -1 or +1 at a rate given by the freq argument, with two differences:
no time quantization fast recovery from low freq values1
If you don't need very high or very low freqs, or use fixed freqs, LFDClipNoise is more efficient.
func (LFDClipNoise) Rate ¶ added in v0.1.4
func (l LFDClipNoise) Rate(rate int8) Input
Rate creates a new ugen at a specific rate. If rate is an unsupported value this method will cause a runtime panic.
type LFDNoise ¶ added in v0.1.3
type LFDNoise struct { Interpolation Interpolation Freq Input }
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.
type LFGauss ¶ added in v0.1.4
LFGauss is a non-band-limited gaussian function oscillator. Output ranges from minval to 1. LFGauss implements the formula:
f(x) = exp(squared(x - iphase) / (-2.0 * squared(width)))
where x is to vary in the range -1 to 1 over the period dur. minval is the initial value at -1.
type LFNoise ¶
type LFNoise struct { Interpolation NoiseInterpolation Freq Input }
LFNoise generates random values at a rate given by the nearest integer division of the sample rate by the Freq input. The values will be interpolated according to the Interpolation input.
type LFPar ¶ added in v0.1.4
type LFPar struct { // Freq is frequency in Hz. Freq Input // IPhase is the initial phase (0..1). IPhase Input }
LFPar is a sine-like shape made of two parabolas and the integral of a triangular wave. It has audible odd harmonics and is non-band-limited. Output ranges from -1 to +1.
type LFPulse ¶
type LFPulse struct { // Freq in Hz Freq Input // IPhase initial phase offset in cycles (0..1) IPhase Input // Width pulse width duty cycle from 0 to 1 Width Input }
LFPulse a non-band-limited pulse oscillator
type LFSaw ¶
type LFSaw struct { // Freq frequency in Hz Freq Input // Iphase initial phase offset in cycles: // for efficiency this is in the rage [0, 2] Iphase Input }
LFSaw a non-band-limited sawtooth oscillator output ranges from -1 to +1
type LFTri ¶
type LFTri struct { // Freq is the approximate rate at which to // generate random values Freq Input // Iphase initial phase offset in the range [0, 4] Iphase Input }
LFTri is a non-band-limited triangle oscillator. Output is [-1, 1].
type Lag ¶ added in v0.1.4
type Lag struct { // In is the input signal. In Input // LagTime is the 60 dB lag time in seconds. LagTime Input }
Lag is essentially the same as OnePole except that instead of supplying the coefficient directly, it is calculated from a 60 dB lag time. This is the time required for the filter to converge to within 0.01% of a value. This is useful for smoothing out control signals.
type Latch ¶ added in v0.1.4
type Latch struct { // In is the input signal. In Input // Trig can be any signal. // A trigger happens when the signal changes from non-positive to positive. Trig Input }
Latch is a sample and hold. It holds input signal value when triggered. Latch will output 0 until it receives its first trigger.
type LeakDC ¶ added in v0.1.4
type LeakDC struct { // In is the input signal. In Input // Coeff is the leak coefficient. Coeff Input // contains filtered or unexported fields }
LeakDC removes DC offset from a signal.
type Limiter ¶
type Limiter struct { In Input // The signal to be processed. Level Input // The peak output amplitude level to which to normalize the input. Dur Input // The buffer delay time. Shorter times will produce smaller delays and quicker transient response times, but may introduce amplitude modulation artifacts. }
Limiter limits the input amplitude to the given level. Limiter will not overshoot like Compander will, but it needs to look ahead in the audio. Thus there is a delay equal to twice the value of the dur parameter. Limiter, unlike Compander, is completely transparent for an in range signal. The Rate method of Limiter will panic if In is nil.
type LinPan2 ¶ added in v0.1.4
LinPan2 is a two channel linear panner. The signal is lowered as it pans from left (or right) to center using a straight line from 1 (left or right) to 0.5 (center) for a 6dB reduction in the middle. A problem inherent to linear panning is that the perceived volume of the signal drops in the middle. Pan2 solves this by taking the square root of the linear scaling factor going from 1 (left or right) to 0.5.sqrt (~=0.707) in the center, which is about 3dB reduction. This is equal power panning. LinPan2 sounds more like the Rhodes tremolo than Pan2.
type LinXFade2 ¶ added in v0.1.4
type LinXFade2 struct { A Input B Input Pan Input // Cross fade position from -1 to +1. Level Input }
LinXFade2 is a two channel linear crossfader.
type Median ¶ added in v0.1.4
Median returns the median of the last length input points. This non-linear filter is good at reducing impulse noise from a signal.
type MouseX ¶
type MouseX struct { // Min is the value of this ugen's output when the // mouse is at the left edge of the screen Min Input // Max is the value of this ugen's output when the // mouse is at the right edge of the screen Max Input // Warp is the mapping curve. 0 is linear, 1 is exponential Warp Input // Lag factor to dezipper cursor movements Lag Input }
MouseX allpass delay with cubic interpolation
type MouseY ¶
type MouseY struct { // Min is the value of this ugen's output when the // mouse is at the left edge of the screen Min Input // Max is the value of this ugen's output when the // mouse is at the right edge of the screen Max Input // Warp is the mapping curve. 0 is linear, 1 is exponential Warp Input // Lag factor to dezipper cursor movements Lag Input }
MouseY allpass delay with cubic interpolation
type MultiInput ¶
MultiInput is the interface of an input that causes cascading multi-channel expansion. See http://doc.sccode.org/Guides/Multichannel-Expansion.html
type NoiseInterpolation ¶
type NoiseInterpolation int
NoiseInterpolation defines different types of interpolation for LFNoise ugens.
const ( NoiseStep NoiseInterpolation = iota NoiseLinear NoiseQuadratic )
Noise interpolation types.
type NumOutputBuses ¶ added in v0.1.4
type NumOutputBuses struct{}
NumOutputBuses provides the number of output buses in a synthdef.
func (NumOutputBuses) Rate ¶ added in v0.1.4
func (n NumOutputBuses) Rate(rate int8) Input
Rate creates a new ugen at a specific rate. If rate is not IR this method will cause a runtime panic.
type OffsetOut ¶ added in v0.1.4
OffsetOut outputs a signal to a bus. Tthe sample offset within the bus is kept exactly; i.e. if the synth is scheduled to be started part way through a control cycle, OffsetOut will maintain the correct offset by buffering the output and delaying it until the exact time that the synth was scheduled for.
type OnePole ¶ added in v0.1.4
type OnePole struct { // In is the input signal. In Input // Coeff is the feedback coefficient. Should be between -1 and +1 Coeff Input }
OnePole is a one pole filter. Implements the formula:
out(i) = ((1 - abs(coef)) * in(i)) + (coef * out(i-1))
type OneZero ¶ added in v0.1.4
type OneZero struct { // In is the input signal. In Input // Coeff is the feed forward coefficient. // +0.5 makes a two point averaging filter (see also LPZ1 ). // -0.5 makes a differentiator (see also HPZ1 ). // +1 makes a single sample delay (see also Delay1 ). // -1 makes an inverted single sample delay. Coeff Input }
OneZero is a one zero filter. Implements the formula:
out(i) = ((1 - abs(coef)) * in(i)) + (coef * in(i-1))
type Osc ¶ added in v0.1.4
Osc is a Linear interpolating wavetable lookup oscillator with frequency and phase modulation inputs. This oscillator requires a buffer to be filled with a wavetable format signal. This preprocesses the Signal into a form which can be used efficiently by the Oscillator. The buffer size must be a power of 2. This can be achieved by creating a Buffer object and sending it one of the "b_gen" messages ( Buffer: -sine1, Buffer: -sine2, Buffer: -sine3 ) with the wavetable flag set to true. This can also be achieved by creating a Signal object and sending it the 'asWavetable' message, thereby creating a Wavetable object in the required format. Then, the wavetable data may be transmitted to the server using the Buffer: *sendCollection or Buffer: *loadCollection methods.
type OscN ¶ added in v0.1.4
OscN is a noninterpolating wavetable lookup oscillator with frequency and phase modulation inputs. It is usually better to use the interpolating oscillator Osc.
type PMOsc ¶
type PMOsc struct { // CarFreq is the carrier frequency in Hz. CarFreq Input // ModFreq is the modulator frequency in Hz. ModFreq Input // PMIndex in the modulation index in radians. PMIndex Input // ModPhase is a modulation input for the modulator's phase in radians. ModPhase Input }
PMOsc is a phase modulation sine-wave oscillator pair.
type PSinGrain ¶ added in v0.1.4
type PSinGrain struct { // Frequency in Hz. Freq Input // Grain duration in seconds. Dur Input // Grain amplitude. Amp Input }
PSinGrain is a very fast sine grain with a parabolic envelope.
type PVBrickWall ¶ added in v0.1.4
type PVBrickWall struct { // FFT Buffer. Buffer Input // Can range between -1 and +1. // If wipe == 0 then there is no effect. // If wipe > 0 then it acts like a high pass filter, clearing bins from the bottom up. // If wipe < 0 then it acts like a low pass filter, clearing bins from the top down. Wipe Input }
PVBrickWall clears bins above or below a cutoff point.
func (PVBrickWall) Rate ¶ added in v0.1.4
func (bw PVBrickWall) Rate(rate int8) Input
Rate creates a new ugen at a specific rate. If rate is an unsupported value this method will cause a runtime panic. If Buffer is nil this method will panic.
type Pairs ¶
type Pairs [][2]float32
Pairs are pairs of floats: the first float is time, the second is level. They get sorted by time.
type Pan2 ¶
type Pan2 struct { // In is the input signal. In Input // Pos is the pan position, -1 is hard left, +1 is hard right. Pos Input // Level is a control rate level input. Level Input }
Pan2 is a two-channel equal power panner. It takes the square root of the linear scaling factor going from 1 (left or right) to 0.5.sqrt (~=0.707) in the center, which is about 3dB reduction. With linear panning (LinPan2) the signal is lowered as it approaches center using a straight line from 1 (left or right) to 0.5 (center) for a 6dB reduction in the middle. A problem inherent to linear panning is that the perceived volume of the signal drops in the middle. Pan2 solves this.
type Pan4 ¶ added in v0.1.4
type Pan4 struct { // In is the input signal. In Input // XPos is the X pan position from -1 to +1 (left to right). XPos Input // YPos is the Y pan position from -1 to +1 (back to front). YPos Input // Level is a control rate level input. Level Input }
Pan4 is a four channel equal power panner. Outputs are in order LeftFront, RightFront, LeftBack, RightBack.
type PanAz ¶ added in v0.1.4
type PanAz struct { NumChans int // In is the input signal. In Input // Pos is the pan position. // Channels are evenly spaced over a cyclic period of 2.0 // in pos with 0.0 equal to channel zero and 2.0/numChans equal to // channel 1, 4.0/numChans equal to channel 2, etc. Pos Input // Level is a control rate level input. Level Input // Width is the width of the panning envelope. // Nominally this is 2.0 which pans between pairs of adjacent speakers. // Width values greater than two will spread the pan over greater numbers of speakers. // Width values less than one will leave silent gaps between speakers. Width Input // Orientation should be zero if the front is a vertex of the polygon. // The first speaker will be directly in front. // Should be 0.5 if the front bisects a side of the polygon. // Then the first speaker will be the one left of center. Orientation Input }
PanAz is a four channel equal power panner. Outputs are in order LeftFront, RightFront, LeftBack, RightBack.
type PanB2 ¶ added in v0.1.4
type PanB2 struct { // In is the input signal. In Input // Azimuth is the position around the circle from -1 to +1. -1 is behind, // -0.5 is left, 0 is forward, +0.5 is right, +1 is behind. Azimuth Input // Gain controls the amplitude of the output signal. Gain Input }
PanB2 encodes a mono signal to 2-dimensional ambisonic B-format.
type Param ¶
type Param interface { // Name returns the name of the synthdef param Name() string // Index returns the index of the synthdef param Index() int32 // InitialValue returns the initial value of the synthdef param InitialValue() float32 }
Param is the interface of a single synthdef parameter.
type Params ¶
type Params interface { // Add adds a named parameter to a synthdef, with an initial value Add(name string, initialValue float32) Input // List returns a list of the params that have been added to a synthdef List() []Param // Control returns a Ugen that should be used as the first ugen // of any synthdef that has parameters Control() *Ugen }
Params is an interface that allows you to add parameters to a synthdef.
type PinkNoise ¶
type PinkNoise struct { }
PinkNoise generates noise whose spectrum falls off in power by 3 dB per octave. This gives equal power over the span of each octave. This version gives 8 octaves of pink noise.
type PlayBuf ¶
type PlayBuf struct { // NumChannels number of playback channels NumChannels int // BufNum buffer to use BufNum Input // Speed is the playback speed: 1.0 for original speed, // 2.0 for Chipmunks, 0.5 for DJ Screw Speed Input // Trigger when this input changes from negative to positive // playback will jump to the beginning of the buffer Trigger Input // Start is the sample frame to start playback Start Input // Loop 1 is on, 0 is off Loop Input // Done action to take when done playing buffer. // See http://doc.sccode.org/Reference/UGen-doneActions.html Done int }
PlayBuf plays back a sample from memory. If Buf is nil a runtime panic will occur.
type Pulse ¶
type Pulse struct { // Freq in Hz Freq Input // Width pulse width duty cycle from 0 to 1 Width Input }
Pulse band-limited pulse wave generator with pulse width modulation.
type PulseCount ¶ added in v0.1.4
type PulseCount struct { // Trig is the trigger signal. // A trigger happens when the signal changes from non-positive to positive. Trig Input // Reset resets the counter to zero when triggered. Reset Input }
PulseCount counts pulses. Each trigger increments a counter which is output as a signal.
func (PulseCount) Rate ¶ added in v0.1.4
func (pc PulseCount) Rate(rate int8) Input
Rate creates a new ugen at a specific rate. If rate is an unsupported value this method will cause a runtime panic.
type PulseDivider ¶ added in v0.1.4
type PulseDivider struct { // Trig can be any signal. // A trigger happens when the signal changes from non-positive to positive. Trig Input // Div is the number of triggers to count before outputting an impulse. Div Input // Start is the starting value for the trigger count. // This lets you start somewhere in the middle of a count. // If start is negative it adds that many counts to the first time the output is triggered. Start Input }
PulseDivider outputs one impulse each time it receives a certain number of triggers at its input.
func (PulseDivider) Rate ¶ added in v0.1.4
func (pd PulseDivider) Rate(rate int8) Input
Rate creates a new ugen at a specific rate. If rate is an unsupported value this method will cause a runtime panic.
type RLPF ¶
type RLPF struct { // In is the input signal In Input // Freq cutoff in Hz Freq Input // RQ Reciprocal of Q RQ Input }
RLPF a resonant low pass filter
type Rand ¶ added in v0.1.3
type Rand struct {
Lo, Hi Input
}
Rand generates a single random float value in uniform distribution from Lo to Hi. It generates this when the SynthDef first starts playing, and remains fixed for the duration of the synth's existence.
type Rater ¶ added in v0.1.4
Rater is the interface of a Ugen that can compute its output at different rates.
type Resonz ¶ added in v0.1.4
type Resonz struct { // In is the input signal. In Input // Freq is the resonant frequency in Hertz. // WARNING: due to the nature of its implementation frequency // values close to 0 may cause glitches and/or extremely loud audio artifacts! Freq Input // BWR is the bandwidth ratio (reciprocal of Q). rq = bandwidth / centerFreq. // The reciprocal of Q is used rather than Q because it saves a divide operation // inside the unit generator. BWR Input }
Resonz is the same as Ringz, except that it has a constant gain at 0 dB instead of being constant skirt. It is a two pole resonant filter with zeroes at z = +-1.
type Ringz ¶ added in v0.1.4
type Ringz struct { // In is the input signal. In Input // Freq is the resonant frequency in Hertz. // WARNING: due to the nature of its implementation frequency // values close to 0 may cause glitches and/or extremely loud audio artifacts! Freq Input // DecayTime is the 60 dB decay time of the filter. DecayTime Input }
Ringz is the same as Resonz, except that it is a constant skirt gain filter, meaning that the peak gain depends on the value of Q. Also, instead of the resonance parameter in Resonz, the bandwidth is specified in a 60dB ring decay time. One Ringz is equivalent to one component of the Klank UGen.
type Rotate2 ¶ added in v0.1.4
type Rotate2 struct {
// X and Y are the input signals.
X, Y Input
// Pos is the angle to rotate around the circle from -1 to +1.
// -1 is 180 degrees, -0.5 is left, 0 is forward, +0.5 is right, +1 is behind.
Pos Input
}
Rotate2 can be used for rotating an ambisonic B-format sound field around an axis. Rotate2 does an equal power rotation so it also works well on stereo sounds. It takes two audio inputs (x, y) and an angle control (pos). It outputs two channels (x, y). It computes this:
xout = cos(angle) * xin + sin(angle) * yin; yout = cos(angle) * yin - sin(angle) * xin;
where angle = pos * pi, so that -1 becomes -pi and +1 becomes +pi. This allows you to use an LFSaw to do continuous rotation around a circle.
func (Rotate2) Rate ¶ added in v0.1.4
Rate creates a new ugen at a specific rate. If rate is an unsupported value this method will cause a runtime panic. If X or Y is nil this method will panic. TODO: we have to be able to access individual outputs of a ugen to be able to implement the Rotate2 example from the SuperCollider help files.
type RunningSum ¶ added in v0.1.4
RunningSum is a running sum over a user specified number of samples, useful for running RMS power windowing.
func (RunningSum) Rate ¶ added in v0.1.4
func (r RunningSum) Rate(rate int8) Input
Rate creates a new ugen at a specific rate. If rate is an unsupported value this method will cause a runtime panic. If the input signal is nil this method will panic.
type SampleDur ¶ added in v0.1.4
type SampleDur struct{}
SampleDur returns the current sample duration of the server. Equivalent to 1/SampleRate.
type SampleRate ¶ added in v0.1.4
type SampleRate struct{}
SampleRate returns the current sample rate of the server.
func (SampleRate) Rate ¶ added in v0.1.4
func (s SampleRate) Rate(rate int8) Input
Rate creates a new ugen at a specific rate. If rate is not IR this method will cause a runtime panic.
type Server ¶
Server represents a running instance of scsynth.
func (*Server) Start ¶
func (s *Server) Start(timeout time.Duration) (io.ReadCloser, io.ReadCloser, error)
Start starts a new instance of scsynth. If the server doesn't print a line containing ServerReadyMessage within the timeout then ErrTimeout is returned.
type ServerStatus ¶
type ServerStatus struct { NumUgens int32 `json:"numUgens"` NumSynths int32 `json:"numSynths"` NumGroups int32 `json:"numGroups"` NumSynthdefs int32 `json:"numSynthdefs"` AvgCPU float32 `json:"avgCPU"` PeakCPU float32 `json:"peakCPU"` NominalSampleRate float32 `json:"nominalSampleRate"` ActualSampleRate float32 `json:"actualSampleRate"` }
ServerStatus represents the reply to the /status command.
type Shaper ¶ added in v0.1.4
type Shaper struct { // BufNum is the number of a buffer filled in wavetable format // containing the transfer function. BufNum Input // In is the input signal. In Input }
Shaper performs waveshaping on the input signal by indexing into the table.
type Silent ¶ added in v0.1.4
type Silent struct { // Number of channels to output. Defaults to 1 if not set. NumChannels int }
Silent outputs silence.
type SinOsc ¶
type SinOsc struct { // Freq is frequency in Hz Freq Input // Phase is the initial phase offset Phase Input }
SinOsc is a table-lookup sinewave oscillator
type SinOscFB ¶ added in v0.1.4
SinOscFB is a sine oscillator that has phase modulation feedback: its output plugs back into the phase input. This allows a modulation between a sine wave and a sawtooth like wave. Overmodulation causes chaotic oscillation. It may be useful if you want to simulate feedback FM synths.
type Slew ¶ added in v0.1.4
type Slew struct { // In is the input signal In Input // Up is the maximum upward slope in units per second. Up Input // Dn is the maximum downward slope in units per second. Dn Input }
Slew limits the slope of an input signal. The slope is expressed in units per second. For smoothing out control signals, take a look at Lag and VarLag.
type Slope ¶ added in v0.1.4
type Slope struct { // Input signal. In Input }
Slope measures the rate of change per second of a signal. The formula implemented is:
out[i] = (in[i] - in[i-1]) * sampling_rate
type SoundIn ¶ added in v0.1.4
type SoundIn struct {
Bus Input
}
SoundIn is a convenience UGen to read audio from the input of your computer or soundcard. It is a wrapper UGen based on In, which offsets the index such that 0 will always correspond to the first input regardless of the number of inputs present.
type Spring ¶ added in v0.1.4
type Spring struct { // Modulated input force. In Input // Spring constant (incl. mass) Spring Input // Damping. Damp Input }
Spring models the force of a resonating spring.
type Sweep ¶ added in v0.1.4
type Sweep struct { // Trig triggers when trig input crosses from non-positive to positive. Trig Input // RaiseRate is the rate/sec raise rate. RaiseRate Input }
Sweep starts a linear raise by rate/sec from zero when trig input crosses from non-positive to positive. When rate == 1, Sweep may be used to get a continually-updating measurement of the time (in seconds) since the last trigger.
type SyncSaw ¶ added in v0.1.4
type SyncSaw struct { // SyncFreq is the frequency of the fundamental. SyncFreq Input // SawFreq is the frequency of the slave synched sawtooth wave. // It should always be greater than SyncFreq. SawFreq Input }
SyncSaw is a sawtooth wave that is hard synched to a fundamental pitch. This produces an effect similar to moving formants or pulse width modulation. The sawtooth oscillator has its phase reset when the sync oscillator completes a cycle. This is not a band limited waveform, so it may alias.
type Synth ¶
type Synth struct { Controls []SynthControl `json:"control"` DefName string `json:"defName"` ID int32 `json:"id"` // contains filtered or unexported fields }
Synth encapsulates a synth node.
func PlayDef ¶
PlayDef plays a synthdef by sending the synthdef using DefaultClient, then immediately creating a synth node from the def.
type SynthArgs ¶ added in v0.1.3
SynthArgs contains the arguments necessary to create a synth that is part of a group.
type SynthControl ¶ added in v0.1.4
SynthControl represents a synth control in a group query.
type SynthNode ¶ added in v0.1.4
type SynthNode struct { Controls map[string]string DefName string // contains filtered or unexported fields }
SynthNode is a node in a graph
type Synthdef ¶
type Synthdef struct { // Name is the name of the synthdef Name string `json:"name" xml:"Name,attr"` // Constants is a list of constants that appear in the synth def Constants []float32 `json:"constants,omitempty" xml:"Constants>Constant"` // InitialParamValues is an array of initial values for synth params InitialParamValues []float32 `json:"initialParamValues,omitempty" xml:"InitialParamValues>initialParamValue"` // ParamNames contains the names of the synth parameters ParamNames []ParamName `json:"paramNames,omitempty" xml:"ParamNames>ParamName"` // Ugens is the list of ugens that appear in the synth def. // The root of the ugen graph will always be last. Ugens []*Ugen `json:"ugens,omitempty" xml:"Ugens>Ugen"` // Variants is the list of variants contained in the synth def Variants []*Variant `json:"variants,omitempty" xml:"Variants>Variant"` // contains filtered or unexported fields }
Synthdef defines the structure of synthdef data as defined in http://doc.sccode.org/Reference/Synth-Definition-File-Format.html
func NewSynthdef ¶
NewSynthdef creates a synthdef by traversing a ugen graph
Example ¶
_ = NewSynthdef("SineTone", func(p Params) Ugen { var ( bus = C(0) sig = SinOsc{}.Rate(AR) ) return Out{Bus: bus, Channels: sig}.Rate(AR) }).WriteJSON(os.Stdout)
Output: {"name":"SineTone","constants":[440,0],"ugens":[{"name":"SinOsc","rate":2,"specialIndex":0,"inputs":[{"ugenIndex":-1,"outputIndex":0},{"ugenIndex":-1,"outputIndex":1}],"outputs":[2]},{"name":"Out","rate":2,"specialIndex":0,"inputs":[{"ugenIndex":-1,"outputIndex":1},{"ugenIndex":0,"outputIndex":0}]}]}
func ReadSynthdef ¶
ReadSynthdef reads a synthdef from an io.Reader
func (*Synthdef) CompareToDef ¶
CompareToDef compare this synthdef to another.
func (*Synthdef) CompareToFile ¶
CompareToFile compares this synthdef to another one stored on disk.
func (*Synthdef) Diff ¶ added in v0.1.4
Diff returns a diff of one synthdef and another. A diff is represented as a slice of pairs of strings. The first string in each pair describes the synthdef on the left (the receiver), and the second string describes the other synthdef.
func (*Synthdef) Write ¶
Write writes a binary representation of a synthdef to an io.Writer. The binary representation written by this method is the data that scsynth expects at its /d_recv endpoint.
type TDelay ¶ added in v0.1.4
type TDelay struct { // In is the input trigger signal. In Input // Dur is the delay time in seconds. Dur Input }
TDelay delays a trigger by a given time. Any triggers which arrive in the time between an input trigger and its delayed output, are ignored.
type TGrains ¶ added in v0.1.4
type TGrains struct { // Number of output channels. NumChannels int // At each trigger, the following arguments are sampled and used as the arguments of a new grain. // A trigger occurs when a signal changes from non-positive to positive value. // If the trigger is audio rate then the grains will start with sample accuracy. Trigger Input // The index of the buffer to use. It must be a one channel (mono) buffer. BufNum Input // 1.0 is normal, 2.0 is one octave up, 0.5 is one octave down -1.0 is backwards normal rate… etc. // (renamed to GRate, to avoid conflicts with Rate method) GRate Input // The position in the buffer in seconds at which the grain envelope will reach maximum amplitude. CenterPos Input // Duration of the grain in seconds. Dur Input // Determines where to pan the output. // If numChannels = 1, the pan argument is ignored. // If numChannels = 2, panning is similar to Pan2. // If numChannels > 2, panning is the same as PanAz. Pan Input // Amplitude of the grain. Amp Input // 1, 2, or 4. Determines whether the grain uses (1) no interpolation, (2) linear interpolation, or (4) cubic interpolation. Interp Input }
TGrains is a buffer granulator
type TLC ¶
type TLC struct {
Time, Level float32
Curve interface{}
}
TLC (time, level, curve) triplet
type TRand ¶ added in v0.1.4
TRand generates a random float value in uniform distribution from Lo to Hi each time Trig changes from nonpositive to positive values.
type ToggleFF ¶ added in v0.1.4
type ToggleFF struct {
Trig Input
}
ToggleFF toggles between 0 and 1 upon receiving a trigger.
type Trig ¶ added in v0.1.4
type Trig struct { // In is the input trigger signal. // A trigger happens when the signal changes from non-positive to positive. In Input // Dur is the duration of the trigger output. Dur Input }
Trig outputs the level of the triggering input for the specified duration when a nonpositive to positive transition occurs at the input. Otherwise it outputs zero.
type Trig1 ¶ added in v0.1.4
type Trig1 struct { // In is the input trigger signal. // A trigger happens when the signal changes from non-positive to positive. In Input // Dur is the duration of the trigger output. Dur Input }
Trig1 outputs 1 for the specified duration when a nonpositive to positive transition occurs at the trigger input. Otherwise it outputs zero.
type Ugen ¶
type Ugen struct { Name string `json:"name" xml:"name,attr"` Rate int8 `json:"rate" xml:"rate,attr"` SpecialIndex int16 `json:"specialIndex" xml:"specialIndex,attr"` Inputs []UgenInput `json:"inputs,omitempty" xml:"Inputs>Input"` Outputs []Output `json:"outputs,omitempty" xml:"Outputs>Output"` NumOutputs int `json:"numOutputs" xml:"numOutputs,attr"` // contains filtered or unexported fields }
Ugen is a unit generator.
func NewUgen ¶ added in v0.1.4
NewUgen is a factory function for creating new Ugen instances. Panics if rate is not AR, KR, or IR. Panics if numOutputs <= 0.
func (*Ugen) Absdif ¶ added in v0.1.4
Absdif returns the absolute value of the difference of two inputs.
func (*Ugen) Bilinrand ¶ added in v0.1.4
Bilinrand returns a linearly distributed random value between [+in ... -in].
func (*Ugen) Coin ¶ added in v0.1.4
Coin returns one or zero with the probability given by the input.
func (*Ugen) Excess ¶ added in v0.1.4
Excess returns the difference of the original signal and its clipped form: (a - clip2(a,b)).
func (*Ugen) Hypot ¶ added in v0.1.4
Hypot returns the square root of the sum of the squares of a and b. Or equivalently, the distance from the origin to the point (x, y).
func (*Ugen) HypotApx ¶ added in v0.1.4
HypotApx returns an approximation of the square root of the sum of the squares of x and y.
func (*Ugen) Linrand ¶ added in v0.1.4
Linrand returns a linearly distributed random value between in and zero.
func (*Ugen) Midiratio ¶ added in v0.1.4
Midiratio converts an interval in MIDI notes into a frequency ratio.
func (*Ugen) Moddif ¶ added in v0.1.4
Moddif returns the smaller of the great circle distances between the two points.
func (*Ugen) Rand ¶ added in v0.1.4
Rand returns an evenly distributed random value between this and zero.
func (*Ugen) Rand2 ¶ added in v0.1.4
Rand2 returns an evenly distributed random value between [+this ... - this].
func (*Ugen) Ratiomidi ¶ added in v0.1.4
Ratiomidi converts a frequency ratio to an interval in MIDI notes.
func (*Ugen) Reciprocal ¶ added in v0.1.4
Reciprocal computes the reciprocal of a signal.
func (*Ugen) Round ¶ added in v0.1.4
Round performs quantization by rounding. Rounds a to the nearest multiple of b.
func (*Ugen) Sqrdif ¶ added in v0.1.4
Sqrdif computes the square of the difference between the two inputs.
func (*Ugen) Sum3rand ¶ added in v0.1.4
Sum3rand returns a value from a gaussian-like random distribution between in and zero.
func (*Ugen) Trunc ¶ added in v0.1.4
Trunc performs quantization by truncation. Truncate a to a multiple of b.
type UgenInput ¶
type UgenInput struct { UgenIndex int32 `json:"ugenIndex" xml:"ugenIndex,attr"` OutputIndex int32 `json:"outputIndex" xml:"outputIndex,attr"` }
UgenInput defines a ugen input as it appears in the synthdef file format.
func (UgenInput) IsConstant ¶ added in v0.1.4
IsConstant returns true if a UgenInput has a UgenIndex of -1
type VOsc ¶ added in v0.1.4
type VOsc struct { // Buffer index. Can be swept continuously among adjacent wavetable buffers of the same size. BufNum Input // Frequency in Hz. Freq Input // Phase (0..1) Phase Input }
VOsc is a wavetable lookup oscillator which can be swept smoothly across wavetables. All the wavetables must be allocated to the same size. Fractional values of table will interpolate between two adjacent tables. This oscillator requires at least two buffers to be filled with a wavetable format signal. This preprocesses the Signal into a form which can be used efficiently by the Oscillator. The buffer size must be a power of 2. This can be achieved by creating a Buffer object and sending it one of the "b_gen" messages ( sine1, sine2, sine3 ) with the wavetable flag set to true. This can also be achieved by creating a Signal object and sending it the asWavetable message, saving it to disk, and having the server load it from there. If you use Buffer objects to manage buffer numbers, you can use the [*allocConsecutive] method to allocate a continuous block of buffers. See the Buffer helpfile for details.
type VOsc3 ¶ added in v0.1.4
type VOsc3 struct { // Buffer index. Can be swept continuously among adjacent wavetable buffers of the same size. BufNum Input // Frequency in Hz of oscillator 1. Freq1 Input // Frequency in Hz of oscillator 2. Freq2 Input // Frequency in Hz of oscillator 3. Freq3 Input }
VOsc3 is a wavetable lookup oscillator which can be swept smoothly across wavetables. All the wavetables must be allocated to the same size. Fractional values of table will interpolate between two adjacent tables. This unit generator contains three oscillators at different frequencies, mixed together. This oscillator requires at least two buffers to be filled with a wavetable format signal. This preprocesses the Signal into a form which can be used efficiently by the Oscillator. The buffer size must be a power of 2. This can be achieved by creating a Buffer object and sending it one of the "b_gen" messages ( sine1, sine2, sine3 ) with the wavetable flag set to true. This can also be achieved by creating a Signal object and sending it the asWavetable message, saving it to disk, and having the server load it from there. If you use Buffer objects to manage buffer numbers, you can use the [*allocConsecutive] method to allocate a continuous block of buffers. See the Buffer helpfile for details.
type VarSaw ¶ added in v0.1.4
type VarSaw struct { // Freq is the oscillator's frequency in Hz. Freq Input // IPhase is the oscillator's initial phase in cycles (0..1). IPhase Input // Width is the duty cycle from 0 to 1. Width Input }
VarSaw is a sawtooth-triangle oscillator with variable duty.
type Variant ¶
type Variant struct { Name string `json:"name,omitempty"` InitialParamValues []float32 `json:"initialParamValues"` }
Variant provides a way to create synthdef presets.
type Vibrato ¶ added in v0.1.4
type Vibrato struct { Freq Input Speed Input Depth Input Delay Input Onset Input RateVariation Input DepthVariation Input IPhase Input }
Vibrato is a slow frequency modulation. Consider the systematic deviation in pitch of a singer around a fundamental frequency, or a violinist whose finger wobbles in position on the fingerboard, slightly tightening and loosening the string to add shimmer to the pitch. There is often also a delay before vibrato is established on a note. This UGen models these processes; by setting more extreme settings, you can get back to the timbres of FM synthesis. You can also add in some noise to the vibrato rate and vibrato size (modulation depth) to make for a more realistic motor pattern. The vibrato output is a waveform based on a squared envelope shape with four stages marking out 0.0 to 1.0, 1.0 to 0.0, 0.0 to -1.0, and -1.0 back to 0.0. Vibrato rate determines how quickly you move through these stages.
type Warp1 ¶ added in v0.1.4
type Warp1 struct { // Number of output channels. NumChannels int // The index of the buffer to use. It must be a one channel (mono) buffer. BufNum Input // The position in the buffer. The value should be between 0 and 1, with 0 being the beginning of the buffer, and 1 the end. Pointer Input // The amount of frequency shift. 1.0 is normal, 0.5 is one octave down, 2.0 is one octave up. Negative values play the soundfile backwards. FreqScale Input // The size of each grain window. WindowSize Input // The buffer number containing a signal to use for the grain envelope. -1 uses a built-in Hanning envelope. EnvBufNum Input // The number of overlapping windows. Overlaps Input // The amount of randomness to the windowing function. Must be between 0 (no randomness) to 1.0 (probably too random actually) WindowRandRatio Input // The interpolation method used for pitchshifting grains. 1 = no interpolation. 2 = linear. 4 = cubic interpolation (more computationally intensive). Interp Input }
Warp1 is a granular time stretcher and pitchshifter. Inspired by Chad Kirby's SuperCollider2 Warp1 class, which was inspired by Richard Karpen's sndwarp for CSound.
type WhiteNoise ¶
type WhiteNoise struct { }
WhiteNoise generates noise whose spectrum has equal power at all frequencies.
func (WhiteNoise) Rate ¶
func (white WhiteNoise) Rate(rate int8) Input
Rate creates a new ugen at a specific rate. If rate is an unsupported value this method will cause a runtime panic.
Source Files ¶
- allpass.go
- analogin.go
- analogout.go
- arrayspec.go
- balance2.go
- ball.go
- ballpass.go
- blip.go
- blowpass.go
- bpf.go
- brf.go
- brownnoise.go
- buffer.go
- c.go
- client.go
- client_buffer.go
- clipnoise.go
- coingate.go
- comb.go
- control.go
- controlrate.go
- conv.go
- cosc.go
- crackle.go
- dc.go
- decay.go
- decay2.go
- decodeb2.go
- defs.go
- delay.go
- detect_silence.go
- digitalin.go
- digitalout.go
- doc.go
- dust.go
- dust2.go
- env.go
- envelope.go
- envgen.go
- fft.go
- formant.go
- formlet.go
- freeverb.go
- fsinosc.go
- gate.go
- gendy1.go
- gendy2.go
- gendy3.go
- grainbuf.go
- grainfm.go
- grainin.go
- grainsin.go
- graynoise.go
- group.go
- gverb.go
- hasher.go
- hpf.go
- ifft.go
- impulse.go
- in.go
- init.go
- input.go
- integrator.go
- interpolation.go
- jpverb.go
- klang.go
- klank.go
- lag.go
- latch.go
- leakdc.go
- lfclipnoise.go
- lfcub.go
- lfdclipnoise.go
- lfdnoise.go
- lfgauss.go
- lfnoise.go
- lfo.go
- lfpar.go
- lfpulse.go
- lfsaw.go
- lftri.go
- limiter.go
- line.go
- linpan2.go
- linxfade2.go
- localbuf.go
- lpf.go
- maxlocalbufs.go
- median.go
- mix.go
- moddif.go
- mousex.go
- mousey.go
- multiInput.go
- num_outout_buses.go
- offset_out.go
- onepole.go
- onezero.go
- operators.go
- osc.go
- oscn.go
- out.go
- output.go
- pan2.go
- pan4.go
- panaz.go
- panb2.go
- param.go
- paramName.go
- pinknoise.go
- playbuf.go
- pmosc.go
- psingrain.go
- pstring.go
- pulse.go
- pulse_count.go
- pulse_divider.go
- pv_brickwall.go
- rand.go
- rate.go
- resonz.go
- ringz.go
- rlpf.go
- rotate2.go
- runningsum.go
- sampledur.go
- samplerate.go
- saw.go
- select.go
- server.go
- server_linux.go
- shaper.go
- silent.go
- sinosc.go
- sinoscfb.go
- slew.go
- slope.go
- soundin.go
- spring.go
- stack.go
- status.go
- sums.go
- sweep.go
- syncsaw.go
- synth.go
- synthdef.go
- synthdef_read.go
- synthdef_write.go
- tdelay.go
- tgrains.go
- toggleff.go
- trand.go
- trig.go
- trig1.go
- ugen.go
- ugenFunc.go
- ugenInput.go
- variant.go
- varsaw.go
- vibrato.go
- vosc.go
- vosc3.go
- warp1.go
- whitenoise.go
- xfade2.go
- xline.go