ChucK Chugins (UGen plugins)

^ programmer's guide | std classes | basic ugen

ABSaturator | AmbPan3 | Bitcrusher | Elliptic | ExpDelay | ExpEnv | Faust | FIR | FluidSynth | FoldbackSaturator | GVerb | KasFilter | Ladspa | MagicSine | Mesh2D | Multicomb | MIAP | NHHall | Overdrive | PanN | Perlin | PitchTrack | PowerADSR | Random | Sigmund | Spectacle | Wavetable | WinFuncEnv | WPDiodeLadder | WPKorg35


ABSaturator

ABSaturator implements soft clip saturating distortion, based on examples from Abel/Berners' Music 424 course at Stanford.

ABSaturator.functions Description
float dcOffset(), dcOffset(float arg) Get/set constant linear offset applied to the signal. A small offset will introduce odd harmonics into the distoration spectrum, whereas a zero offset will have only even harmonics.
float drive(), drive(float arg) Get/set nput gain into the distortion section, in decibels. Controls overall amount of distortion.

see test.ck


AmbPan3

AmbPan3 implements a 3d spatialization that characterizes source location by its elevation and azimuth angles.

AmbPan3.functions Description
float azimuth(), azimuth(float arg) The left/right turn angle
float elevation(), elevation(float arg) The up/town tilt angle
void channelMap(int[] arg) a map of the auditory sphere onto channel numbers

see test.ck, test.ck,


Bitcrusher

Bitcrusher.functions Description
int bits(), bits(int arg) get/set the bits to crush to
int downsampleFactor(), downsampleFactor(int arg) get/set

see test.ck


Elliptic

Elliptic implements cascaded IIR filters and a built-in elliptical filter design. It is capable of low-pass, high-pass, or bandpass filtering with very steep slopes. The atten determines how much of the signal is attenuated outside the passband.

Elliptic filters come with a trade-off for their steep slopes: they have a certain amount of ripple outside the passbands. A very small ripple (0.1 or 0.2 dB) produces very little ringing, whereas a large ripple (eg. 20 dB) produces a very strong harmonic ring.

The filter design algorithm sometimes can't fulfill the design criteria -- a particular combination of cutoff frequencies, ripple, and attenuation. If that happens, the user is warned that the filter is not initialized, and the filter is bypassed. This may happen, for instance, if you ask for a very steep attenuation with very low ripple.

Before using the filter, you must initialize it as a low-pass (lpf), high-pass (hpf), or band-pass filter and designate the passband and stopband frequencies.

Elliptic.functions Description
void lpf(float pass, float stop) init as a lowpass filter
void hpf(float stop, float pass) init as a highpass filter
void bpf(float lower, float upper, float stop ) init as a bandpass filter (usually these parameters are ascending values.)
float atten(), atten(float): get/set filter attenuation in dB. Default 90.0
float ripple(), ripple(float): get/set filter ripple in dB. Default 0.2
int bypass(), bypass(int) get/set bypass switch: on or off. Default 0

see test.ck


ExpDelay

ExpDelay - Feedback delay at exponentially changing delay times.

by Joel Matthys 2014, GPL 2.0

ExpDelay.functions Description
float mix(), mix(float) get/set dry/wet mix [0-1]
dur max(), max(dur) maximum possible delay duration
dur delay(), delay(dur) duration of delay
int reps(), reps(int) number of repetitions
float durcurve(), durcurve(float) set steepness of delay curve, 1 = steady <1 = starts fast and slows down >1 = starts slow and speeds up
float ampcurve(), ampcurve(float) set steepness of amplitude decay

see test.ck


ExpEnv

ExpEnv - Simple Decaying Exponential Envelope Unit Generator.

Simple single time constant exponential decay, applied to any signal passed through it. Obeys: value, T60, radius, and keyOn Especially useful for Modal synthesis. One of these for each mode: SinOsc s => ExpEnv e => dac;

Also useful for noise excitation pulse, using it like: Noise n => ExpEnv e => dac;

Copyright (c) 2015 Perry R. Cook. GPL 2.0

ExpEnv.functions Description
float radius(), radius(float) get/set radius [0, 1] directly
dur T60(), T60(dur) get/set T60 radius indirectly
void keyOn(int) trigger

see test.ck


FIR

FIR Finite Impulse Reponse Filter plugin

by Perry R. Cook
Version 1.0
October 2012

FIR.functions Description
int bpHetero(), bpHetero(float arg) set bandpass
float coeff(int arg, float arg2) set filter coefficients directly
float coeff(int arg)
int gaussian(float arg) set filter coefficients indirectly
int order(), order(int arg) get/set order
int sinc(float arg) set filter coefficients indirectly

see FIRConvolve.ck, FIRConvolveHomer.ck, FIRConvolve.ck, FIRFOFTest.ck, FIRGaussImpulseTests.ck, FIRSincBPSweepTest.ck, FIRSincExplicit.ck, FIRSincImplicit.ck, FIRSincTests.ck, GreyholeDownUpDecimateDemo.ck,


FluidSynth

FluidSynth chugin bridge to the open-source FluidSynth synthesizer that implements sound font support. This chugin will only work if you've got fluidsynth installed.

FluidSynth.functions Description
void open(string) opens a sound font 2 file
void noteOn(int midiNote, int midiVelocity) play a note on the current program
void noteOff(int midiNote) release a note
void noteOnChannel(int midiNote, int midiVelocity) play a note on the current program
void noteOffChannel(int midiNote) release a note
void progChange(int p), progChange(int p, int ch) select a program from the current sf2 and associated with a midi channel indexed starting at 0
void setBank(int bank), setBank(int bank, int ch) select a synth bank
void setPitchBend(int bend), setPitchBend(int, int ch) set the current pitch bend
int getPitchBend(), getPitchBend(int ch) get the current pitch bend
void resetPitchBend(), resetPitchBend(int ch)
void setTuning(float []), setTuning(float [], int ch activate key tuning
void setOctaveTuning(float []), setOctaveTuning(float [], int ch activate key tuning
void resetTuning(), resetTuning(int ch)
void tuneNote(int noteNum, float pitch), tuneNote(int, float, int ch)
void tuneNotes(int noteNums[], float pitches[], int ch)
inherited from UGen
float gain(), gain(float) get/set current gain

see test.ck, pitchbend.ck, play.ck, tuning.ck


FoldbackSaturator

FoldbackSaturator is a distortion which "folds back" a signal as it passes a (positive and negative) threshold. This implementation also includes an index, which the signal is multiplied by as it passes the threshold, for a more intense effect.

FoldbackSaturator.functions Description
float makeupGain(), makeupGain(float g) Get/set the amount of makeup gain applied to the signal after processing, multiplied against the reciprocal of the threshold. Defaults to 1.0
float threshold(), threshold(float t) Get/set The threshold (positive and negative) that the signal is inverted against as it is passed. Defaults to 0.6
float index(), index(float t) Get/set The index that the signal is multiplied by after it is inverted against the threshold. Defaults to 2.0

see test-index.ck, test-threshold.ck,


GVerb

GVerb is s a very smooth reverberator with the ability to produce very long reverb times.

GVERB is based on the original "gverb/gigaverb" by Juhana Sadeharju (kouhia at nic.funet.fi). The code for this version was adapted from RTcmix (http://rtcmix.org), which in turn adapted it from the Max/MSP version by Olaf Mtthes (olaf.matthes at gmx.de).

GVerb.functions Description
float roomsize(), roomsize(float) get/set room size [1.0 - 300.0], default 30.0
dur revtime(), revtime(dur) get/set revert time dur, default 5::second
float damping(), damping(float) get/set damping [0.0 - 1.0], default 0.0
float spread(), spread(float) (private) get/set spread default 15.0
float bandwidth(), bandwidth(float) get/set inputbandwidth [0.0 - 1.0], default 0.5
float dry(), dry(float) get/set dry [0.0 - 1.0], default 0.6
float early() early(float) get/set early [0.0 - 1.0], default 0.4
float tail() tail(float) get/set early [0.0 - 1.0], default 0.5

see test.ck


KasFilter

KasFilter implements an under-sampling-based resonant lowpass filter.

by Kassen

KasFilter.functions Description
float freq(), freq(float) get/set the cutoff frequency. This sets both the frequency at which the 2 sample&holds sample the input signal and the frequency of the sine that crossfades between them.
float resonance(), resonance(float) get/set the resonance, which is implemented as negative feedback. accepts values between 0 and 0.95
float accent(), accent(float) get/set the amount of waveshaping on the crossfading sine. Ranges from 0 to 1, where 1 is close to regular under-sampling (if no resonance is used).

see test.ck, readme.ck


MagicSine

MagicSine implements efficient sine oscillator using the iterative "magic circle" algorithm, at the expense of not being able to set the phase (for now at least). Uses 4 multiplies + 2 adds per sample.

MagicSine is about 25% faster when running a fixed freq sine wave, so its main use is when you need a lot of sine waves and are hitting a performance bottleneck.

By Spencer Salazar (GPL 2)

MagicSine.functions Description
float freq(), freq(float) set the oscillartor frequency */

see test.ck


Mesh2D

Mesh2d is a two-dimensional rectilinear waveguide mesh class.

Part of the Synthesis Toolkit in C++, this chugin implements a rectilinear, two-dimensional digital waveguide mesh structure. For details, see Van Duyne and Smith, "Physical Modeling with the 2-D Digital Waveguide Mesh", Proceedings of the 1993 International Computer Music Conference. This is a digital waveguide model, making its use possibly subject to patents held by Stanford University, Yamaha, and others.

Mesh2D.functions Description
int x(), x(int) get/set X dimension size in samples. int [2-12], default 5
int y(), y(int) get/set Y dimension size in samples. int [2-12], default 4
float xpos(), xpos(float) get/set x strike position. float [0-1], default 0.5
float ypos(), ypos(float) get/set y strike position. float [0-1], default 0.5
float decay(), decay(float) get/set decay factor. float [0-1], default 0.999

see help.ck


Multicomb

Multicomb Multiple simultaneous comb filters randomly chosen within a specified frequency range and spread across the stereo field.

Multicomb.functions Description
int num(), num(int) get/set number of comb filters (default 5)
float minfreq(), minfreq(float) get/set low frequency
float maxfreq(), maxfreq(float) get/set high frequency
float set(float, float) set both low and high freqs
dur revtime(), revtime(dur) get/set total ring time (default 1::second)

see help.ck


NHHall

NHHall is an open source algorithmic reverb unit, developed by Nathan Ho in 2018 for SuperCollider, ChucK, and Auraglyph.

Features:

NHHall.functions Description
float rt60(), rt60float) default 1::second
float stereo(), stereo(float) [0.0 - 1.0], default 0.5
float lowFreq(), lowFreq(float) default 200
float lowRatio(), lowRatio(float) default 0.5
float hiFreq(), hiFreq(float) default 4000
float hiRatio(), hiRatio(float) default 0.5
float earlyDiffusion(), earlyDiffusion(float) [0.0 - 1.0], default 0.5
float lateDiffusion(), lateDiffusion(float) [0.0 - 1.0], default 0.5
float modRate(), modRate(float) [0.0 - 1.0], default 0.2
float modDepth(), modDepth(float) [0.0 - 1.0], default 0.3

see help.ck


Overdrive

Overdrive Simple overdrive distortion created by applying a non-linear transfer function to the input signal. Adapted from cyclone/overdrive~ from Pd.

Overdrive.functions Description
float drive(), drive(float) get/set the distortion amount. 1 is no distortion. > 1 simulates overdrive, 0-1 simulates underdrive (?)

see help.ck


PanN

The PanN family of chugins supports 4, 8, and 16 channel equal-power panning. The default channel maps for each class alternate left then right, front to back

Pan4,Pan8,Pan16.functions Description
__float pan(), pan(float) get/set pan, pan is modulo nchannels, ie: Pan4 [0-4], Pan8 [0-8], Pan16 [0-16]
Pan4 channels[0-3] [0, 1, 3, 2]
Pan8 channels[0-7] [0, 1, 3, 5, 7, 6, 4, 2]
Pan16 channels[0-15] [0, 1, 3, 5, 7, 9, 11, 13, 15, 14, 12, 10, 8, 6, 4, 2]

see Pan4-test.ck Pan8-test.ck


Perlin

Perlin produces a form of bandlimited noise, known as gradient noise and has been used extensively in the field of Computer Graphics Imagery (CGI). There it is often used to produce fractals though the summation of multiple octaves of perlin noise.

Perlin.functions Description
float freq(), freq(float) get/set the bandlimited noise frequency

see test.ck, wikipedia


PitchTrack

PitchTrack is a monophonic autocorrelation pitch tracker with a fast response and extremely high accuracy, even at low frequencies. It is adapted from helmholtz~ for Pd by Katja.

PitchTrack.functions Description
float get() get calculated frequency
float fidelity(), fidelity(float) get/set fidelity[0-1], default 0.95. This is a threshold for certainty about the result. A highly periodic signal (ie one that has a strong pitch center) should produce a result with a high fidelity, which a non-periodic signal (eg noise) will have a very low fidelity. Setting this parameter close to 1 should reduce the number of inaccurate reports.
float sensitivity(), sensitivity(float) get/set sensitivity [0-1], default 0.003. This is the minimum RMS value to trigger a pitch calculation. Setting this parameter low forces PitchTrack to attempt to find the pitch of even very quiet sounds. Higher values will cause it to trigger only on louder notes.
int overlap(), overlap(int) get/set overlap [1-?], default 2. How much to overlap successive analysis frames. Higher values should produce smoother values, at the cost of an increase of CPU load.
int frame(), frame(int) get/set frame [128-?], default 2048. Size of FFT frame for analysis. Smaller values result in lower latency and high responsiveness but less accuracy. Higher values result in considerably greater CPU load. Values that aren't powers of 2 get rounded up to the next power of 2. Recommend 512, 1024, or 2048
float bias(), bias(float) get/set bias [0-1], default 0.2. Katja's pitch tracker introduces a small bias to help with the tracking. (See the link above.) I don't know how this parameter affects the output.

see pitchtrack-help.ck,


PowerADSR

PowerADSR is a power based ADSR envelope that allows separate power curves for each envelope phase. In general, curves under 1.0 are sharp, while curves over 1.0 are soft. You can think of it as approximately: pow(linearEnvelope, curveValue).

PowerADSR.functions Description
void set(dur a, dur d, float suslev, dur r), sets duration for attack, decay, and release phase; sets sustain level, default (0.0, 0.0, 1.0, 0.0)
dur attachTime(), attackTime(dur) get/set attackTime, duration of the attack phase (can be shortened to attack()).
dur decayTime(), decayTime(dur) get/set decayTime, duration of the decay phase (can be shortened to decay()).
float sustainLevel(), sustainLevel(float s) get/set level for the sustain phase. default 0.5
void setCurves(float ac, float dc, float rc) sets power curve for attack, decay, and release phase. default (1.0, 1.0, 1.0) (all linear)
float attackCurve(), attackCurve(float ac) get/set power curve for the attack phase. default 1.0 (linear)
float decayCurve(), decayCurve(float ac) get/set power curve for the decay phase. default 1.0 (linear)
float releaseCurve(), releaseCurve(float ac) get/set power curve for the release phase. default 1.0 (linear)
float value() returns the current envelope value
int state() returns the current envelop state. 0: inactive, 1: attach, 2: decay, 3: sustain, 4: release

see poweradsr-help.ck, poweradsr-test.ck


Random

Random produces random numbers that obey the gaussian (or normal) distribution.

Random.functions Description
void seed(int) seed the random number generator
float gaussian(float mean, float dev) request a new random number distributed with mean and std deviation

see test.ck, wikipedia


Sigmund

Sigmund sinusoidal analysis and pitch tracking. By Miller Puckette, Ron Mayer, …

Sigmund.functions Description
int npts(), npts(int) get/set number of points used in analysis. Must be a power of 2, at least 128. The minimum frequency that can be tracked is about 2 * samplerate / npts. default: 1024
int npeak(), npeak(int) get/set maximum number of sinusoidal peaks to look for. The computation time is quadratic in the number of peaks actually found (this number only sets an upper limit). Use it to balance CPU time with quality of results.
float maxfreq(), maxfreq(float) get/set maximum frequency of sinusoidal peaks to look for. This can be useful in situations where background nose creates high-frequency, spurious peaks…
float minpower(), minpower(float) get/set minimum dB level to report a pitch. Signals quieter than this will be assumed to be crosstalk and ignored. default: 50
float freq() get reported frequency of input signal
float env() get reported RMS value (in dB) of input signal
float peak(int) report freq of nth sinusoundal peak sorting depends on parameter "dotracks"
float amp(int) report amplitude of nth sinusoundal peak sorting depends on parameter "dotracks"
int tracks(), tracks(int) toggle (0 or 1) whether peak and amp are sorted in order of amplitude or organized into tracks
void clear() clear buffers and reset
float param1(), param1(float) mysterious settings #1
float param2(), param2(float) mysterious settings #2
float param3(), param3(float) mysterious settings #3

see sigmund-help.ck, sigmund-tracks-test.ck


Spectacle

SPECTACLE is an FFT-based delay instrument by John Gibson and inspired by the totally awesome Spektral Delay plug-in by Native Instruments. This version is adapted from RTcmix (rtcmix.org) by Joel Matthys (GPL 2).

Spectacle.functions Description
float mix(), mix(float) get/set mix (0-1) of processed and unprocessed signal. default 1.0
void clear() reset Spectacle
int fftlen(), fftlen(int) get/set FFT frame size (power of 2)
int overlap(), overlap(int) get/set frame overlap; best between 2 and 6
dur delayMax(), delayMax(dur) get/set maximum delay time
dur delayMin(), delayMin(dur) get/set minimum delay time
float freqMax(), freqMax(float) get/set maximum frequency processed by Spectacle
float freqMin(), freqMin(float) get/set minimum frequency processed by Spectacle
void range (float, float) set both min and min freqs in one command
int bands(), bands(int) get/set number of frequency bands, 1-512, default 64
dur delay(), delay(dur) get/set the same duration for all bands
float eq(), eq(float) get/set the same EQ value for all bands (value is +/- dB)
float feedback(), feedback(float) get/set the same feedback value for all bands (-1.0 - 1.0)
void table(string, string) set delay, eq, or feedback tables to "random", "ascending", or "descending". example: table ("delay", "random");

see spectacle-help.ck,


Wavetable

Wavetable User-definable Wavetable with various interpolation algorithms. By Joel Matthys, (c) 2016, GPL 2.0

Wavetable.functions Description
float freq(), freq(float) get/set frequency
int interpolate(), interpolate(int) get/set interpolation: 0: no interpolation, 1: linear, 2: cubic, 3 = Hermite
void setTable(float[]) associate a ChucK array with the Wavetable instrument
int sync(), sync(int) get/set sync: 0:input controls frequency, 1: input (usually Phasor) controls phase.

By default the Wavetable instrument uses a 2048-point non-interpolating sine table.

see wavetable-help.ck, input-test.ck, interpolation-test.ck


WinFuncEnv

WinFuncEnv is an Attack/Release envelope built around window functions!

WinFuncEnv.functions Description
.set (dur, dur) set duration for attack and release phase. default (0.0, 0.0)
.attackTime(dur) sets length for the attack phase. default 0.0
.releaseTime (dur) sets length for the release phase. default 0.0

Window functions available for use as envelopes:

setBlackman(), setBlackman(float a)
setBlackmanHarris().
setBlackmanDerivative (float a0, float a1, float a2, float a3)
setBlackmanNutall()
setExponential(), setExponential(float a)
setHann()
setHannPoisson(), setHannPoisson(float a)
setNutall()
setParzen()
setPoisson(), setPoisson(float a)
setTukey(), setTukey(float a)
setWelch()

see winfuncenv-help.ck


WPDiodeLadder

WPDiodeLadder is a virtual analog model of the Diode Ladder filter. The VADiodeLadderFilter and VAOnePoleFilter are taken directly from Will Pirkle's applications notes, and can be found here. Ported by Owen Vallis 2015

From Pirkle's app note:

The Diode Ladder Filter first appeared in the EMS VCS3 Monophonic Synth designed by David Cockerell in 1969. It is (more famously) incorporated in the Roland TB-303 BassLine monophonic bass synth from 1982. It is based on the Moog Ladder Filter (see App Note 4) but incorporates multiple feedback paths between sections. The effect of the feedback paths on the signal is two-fold: like the Moog Ladder, it reduces overall filter gain as the resonance increases but the reduction is more extreme (by about 12dB) and secondly, as the resonance increases, the resonant frequency migrates upwards, but never makes it to the cutoff frequency (which does not occur in the Moog Ladder). Like the Moog Ladder it also self oscillates. At the point of self-oscillation, the poles (and therefore the resonant peak) will have drifted up to fc/sqrt(2).

WPDiodeLadder.functions Description
float resonance(), resonance() get/set the resonance [0-17]
float cutoff(), cuttoff(float) get/set cutoff (Hz) [0-Nyquist]
float saturation(), saturation(float) get/set saturation. Saturation is a scalar gain, and can be used to drive the non-linearity.
int nonlinear(), nonlinear(int) get/set nonlinear [0,1] 1 enables thel inear saturator.
int nlp_type(), nlp_type(int) get/set nlp_type [0,1] 1 normalizes non-linear output.

see WPDiodeLadder-test.ck


WPKorg35

WPKorg35 is a virtual analog model of the Korg 35 LP filter. The KorgThreeFiveLPF and VAOnePoleFilter are taken directly from Will Pirkle's applications notes, and can be found here. Ported by Owen Vallis 2015

From Pirkle's app note:

The Korg35 lowpass filter is found in the Korg MS-10 and early MS-20 synthesizers. It is currently incorporated in the new Korg Monotron synth. Variations are also found in other Korg products. The Monotron version differs slightly in components but is otherwise faithful to the originalʼs functionality. The Korg35 lowpass filter is a 2nd order resonant lowpass type. Unlike its contemporaries of the time (the Moog Ladder and Diode Ladder filters) it does not reduce overall gain as the resonance is increased. Because of this it is often overlooked. However the skyrocketing popularity of the MS-20 (and new MS-20 Mini) as well as the Monotron make it worth investigating. Indeed there is more than meets the eye with this filter. It can not be implemented using the standard BZT -> Biquad design. The reason is that the Korg35 is capable of self-oscillation - this is what makes it attractive as a synth filter as well as for study.

WPKorg35.functions Description
float resonance(), resonance() get/set the resonance [0-2]
float cutoff(), cuttoff(float) get/set cutoff (Hz) [0-Nyquist]
float saturation(), saturation(float) get/set saturation. Saturation is a scalar gain, and can be used to drive the non-linearity.
int nonlinear(), nonlinear(int) get/set nonlinear [0,1] 1 enables thel inear saturator.

see WPKorg35-test.ck

home .. language .. program .. examples