OpenMusic

Visual Programming | Computer-Assisted Composition

OpenMusic Reference

Prev| | Next


interpolation

interpolation

(arithmetic module) -- interpolates between two numbers or lists

Syntax

interpolation begin end samples curve

Inputs

name| data type(s)| comments
—|—|—
begin | a number or tree| the starting point for the interpolation
end | a number or tree| the end point for the interpolation
samples | a number| the number of elements to interpolate. Includes begin and end ; a value of three is therefore equal to a single interpolated value or list of values between the starting and ending point.
curve | a float| specifies the curve of the interpolated values. Defaults to 1.0.

Output

output data type(s) comments
first a tree Returns a list of numbers or trees, being the interpolation between begin and end

Description

Creates a list or tree of values interpolated between the two first inputs. The number of values interpolated is specified at the third input. Since the first and the last elements of the result are the same as the starting and ending values, the actual number of ‘frames’ in between the starting and ending point is two less than the value specified at samples . The last input specifies the curvature of the interpolation. With a value of 1.0, the interpolation is ‘flat,’ meaning that the distance between any element and it’s neighbors is the same. Values smaller than 1.0 generate a convex curvature, values greater than 1.0 generate a concave curvature. See the example below.

See also the function samplefun .

Examples

What curvature means in interpolation

Above we see a graphic representation of the effects of changing the curve of the interpolation. Recall that a curve of 1.0 is a flat interpolation where the elements are evenly-spaced. Here two interpolations have been performed between the numbers 1 and 100, to the tune of 50 samples each. Both interpolations have been plotted on the y-axis of a bpf object. On the left, the curve has been set to .4. This causes the distances between the elements to be larger earlier on in the interpolation, and the curve rises faster (read left to right). On the right, curve has been set higher then 1.0, to 2.4. Thus, the elements are closer together earlier on in the interpolation but further apart towards the upper end. The curve rises slowly on the left and quickly on the right. Leaving curve at 1.0 would have produced a straight diagonal line.


Prev Home Next
interlock Up last-elem