Sound.SC3.UGen.Envelope.Interpolate

Description

Interpolation functions for envelope segments.

Synopsis

# Documentation

type Interpolation_F t = t -> t -> t -> t Source

An interpolation function take three arguments. x0 is the left or begin value, x1 is the right or end value, and t is a (0,1) index.

Step function, ignores t and returns x1.

Linear interpolation.

Exponential interpolation, x0 must not be `0`, (x0,x1) must not span `0`.

```import Sound.SC3.Plot
plotTable1 (map (exponential 0.001 1) [0,0.01 .. 1])```

exponential' :: (Eq t, Floating t) => Interpolation_F t Source

Variant that allows x0 to be `0`, though (x0,x1) must not span `0`.

```plotTable1 (map (exponential' 0 1) [0,0.01 .. 1])
plotTable1 (map (exponential' 0 (-1)) [0,0.01 .. 1])```

exponential'' :: (Eq t, Floating t) => Interpolation_F t Source

`linear` of `exponential'`, ie. allows (x0,x1) to span `0`.

`plotTable1 (map (exponential'' (-1) 1) [0,0.01 .. 1])`

`linear` with t transformed by sine function over (-pi2,pi2).

`plotTable1 (map (sine (-1) 1) [0,0.01 .. 1])`

welch :: (Ord t, Floating t) => Interpolation_F t Source

If x0 `<` x1 rising sine segment (0,pi/2), else falling segment (pi/2,pi).

```plotTable1 (map (welch (-1) 1) [0,0.01 .. 1])
plotTable1 (map (welch 1 (-1)) [0,0.01 .. 1])```

curve :: (Ord t, Floating t) => t -> Interpolation_F t Source

Curvature controlled by single parameter c. `0` is `linear`, increasing c approaches `exponential`.

```plotTable1 (map (curve 0 (-1) 1) [0,0.01 .. 1])
plotTable1 (map (curve 9 (-1) 1) [0,0.01 .. 1])```

Square of `linear` of `sqrt` of x0 and x1, threfore neither may be negative.

`plotTable1 (map (squared 0 1) [0,0.01 .. 1])`

Cubic variant of `squared`.

`plotTable1 (map (cubed 0 1) [0,0.01 .. 1])`

hold :: (Num t, Eq t) => Interpolation_F t Source

x0 until end, then immediately x1.