Safe Haskell | Safe-Inferred |
---|

A *warp* is a mapping from the space `[0,1]`

to a user defined
space *[l,r]*.

- data W_Direction
- type Warp t = W_Direction -> t -> t
- w_map :: Warp t -> t -> t
- w_unmap :: Warp t -> t -> t
- warpLinear :: Fractional a => a -> a -> Warp a
- warpExponential :: Floating a => a -> a -> Warp a
- warpCosine :: Floating a => a -> a -> Warp a
- warpSine :: Floating a => a -> a -> Warp a
- warpFader :: Floating a => Warp a
- warpDbFader :: (Eq a, Floating a) => Warp a
- warpCurve :: (Ord a, Floating a) => a -> a -> a -> Warp a

# Documentation

data W_Direction Source

type Warp t = W_Direction -> t -> tSource

Warp type

warpLinear :: Fractional a => a -> a -> Warp aSource

A linear real value map.

> w = LinearWarp(ControlSpec(1,2)) > [0,0.5,1].collect{|n| w.map(n)} == [1,1.5,2]

map (w_map (warpLinear 1 2)) [0,1/2,1] == [1,3/2,2] map (warpLinear (-1) 1 W_Map) [0,1/2,1] == [-1,0,1]

warpExponential :: Floating a => a -> a -> Warp aSource

The left and right must both be non zero and have the same sign.

> w = ExponentialWarp(ControlSpec(1,2)) > [0,0.5,1].collect{|n| w.map(n)} == [1,pow(2,0.5),2]

map (warpExponential 1 2 W_Map) [0,0.5,1] == [1,2 ** 0.5,2]

warpCosine :: Floating a => a -> a -> Warp aSource

Cosine warp

> w = CosineWarp(ControlSpec(1,2)) > [0,0.25,0.5,0.75,1].collect{|n| w.map(n)}

map (warpCosine 1 2 W_Map) [0,0.25,0.5,0.75,1]

warpSine :: Floating a => a -> a -> Warp aSource

Sine warp

map (warpSine 1 2 W_Map) [0,0.25,0.5,0.75,1]

warpFader :: Floating a => Warp aSource

Fader warp. Left and right values are implicitly zero and one.

map (warpFader W_Map) [0,0.5,1] == [0,0.25,1]

warpDbFader :: (Eq a, Floating a) => Warp aSource

DB fader warp. Left and right values are implicitly negative
infinity and zero. An input of `0`

gives `-180`

.

map (round . warpDbFader W_Map) [0,0.5,1] == [-180,-12,0]