LFGauss:
Filter:
Classes | UGens > Generators > Deterministic

LFGauss : UGen : AbstractFunction : Object

Gaussian function oscillator
Source: Osc.sc

Description

A non-band-limited gaussian function oscillator.

LFGauss implements the formula:

f(x) = exp((x - iphase)^2 / (-2.0 * width^2))

where x in this context is the phase, which cycles in a range -1 to 1 over the period duration. The Gaussian function in this form is a bell-shaped apodization function, making it convenient for use as an envelope.

Its minimum value occurs when the phase x = -1 and x = 1, and its maximum occurs when x = 0.

Class Methods

LFGauss.ar(duration: 1, width: 0.1, iphase: 0.0, loop: 1, doneAction: 0)

LFGauss.kr(duration: 1, width: 0.1, iphase: 0.0, loop: 1, doneAction: 0)

Arguments:

duration

Duration of one cycle, in seconds. (Hint: duration = 1/frequency). Default: 1

width

The width of the bell curve (its standard deviation).

Practically speaking, a width <= 0.25 will give minimum values near, but not equal to, zero.

The bell curve becomes broader with increasing width. Beyond roughly >= 0.25 the function has the appearance of being truncated, or, when loop = 1, the cycles begin to "overlap". Default: 0.1

iphase

Initial offset phase offset in the range [-1, 1]. Default: 0

loop

If loop > 0, the function repeats. Otherwise, it calls doneAction after one cycle. Default: 1

doneAction

A doneAction value, which is evaluated at the end of a cycle (if loop = 0). 2 frees the synth. Default: 0 (continues running). See Done: Actions for more options.

Discussion:

By default, the maximum value of LFGauss is 1. The minimum value will depend on the width, and can by inspected with -minval.

The function can be mapped to a specified range with -range, which can be useful when using LFGauss as an envelope that may need to span a range of, e.g., [0, 1].

See the examples below for understanding and manipulating the Min and max values, curve width.

Inherited class methods

Instance Methods

.minval

Returns the function's lowest value for the given width parameter, which is exp(1.0 / (-2.0 * width^2)).

.range(min: 0, max: 1)

Scales the output to the given range. This can be convenient when using LFGauss as an envelope (see examples below).

Inherited instance methods

Examples

Example plots

Min and max values, curve width

-minval for a given width (assuming iphase = 0) is:

minval = exp(-1.0 / (2.0 * squared(width)))

width for a given -minval is:

width = sqrt(-1.0 / log(minval))

width at half of the maximum value(0.5) is:

(2 * sqrt(2 * log(2)) * width) = ca. 2.355 * width

Sound examples

Gabor Grain

NOTE: The gaussian function doesn't start with 0 – it asymptotically approaches it at -inf and inf. When using it as an envelope, it has to start at some smaller value, and it has an offset for this value. You can remove this offset by explicitly setting the -range, e.g. to [0, 1] (this is the default).