# Parameter Curves

Media parameters are able to follow a curve over time. Each curve is described by a mathematical formula and two end-points. Each end-point is defined by a reference time and the value of the curve at that time. The formula is used to calculate intermediate values between the points, and determines the shape of the curve. The possible curves are:

• Jump
• Linear
• Square
• Inverse square
• Sine

"Jump" means jump directly to the end value. The other curves are shown in the following diagram.

Mathematically, the curves work as follows. Suppose that a curve begins at time t0 with a value of v0, and ends at time t1 with a value of v1. The two points that define the curve are (t0,v0) and (t1,v1).

• Let Δt be the total duration of the curve, t1t0.
• Let Δv be the interval between the starting and ending values, v1v0.
• At any time t such that t0 <= t <= t1, let Δt' = tt0.

The value of the parameter at time t is:

v = f( Δt' / Δt ) * Δv + v0

where f(x) is a function determined by the curve type:

• Linear: y = x
• Square: y = x2
• Inverse square: y = sqrt(x)
• Sine: y = [ sin(πx – π/2) + 1 ] / 2

Observe that Δt' < Δt, so the term Δt'/Δt ranges from 0 to 1. Therefore, f(x) also ranges from 0 to 1, and v always falls between v0 and v1. This is true whether v0 < v1 or vice versa. In other words, the curve is bounded by the rectangle (t0,v0,t1,v1).

For the sine curve, the value of (πx – π/2) ranges from –π/2 to π/2, which means that sin(πx – π/2) ranges from –1 to 1. The result is then normalized so that f(x) falls into the range (0–1).