Karya, built on Sun Nov 26 01:04:37 PST 2017 (patch 0a920b2bde70c0cbac8ee09d158064798b61bbe5)

Derive.Call.ControlUtil

Description

Utilities that emit Signal.Controls and ControlMods.

Synopsis

# Documentation

Sampling rate.

type Curve = Double -> Double Source #

Interpolation function. This maps 0--1 to the desired curve, which is also normalized to 0--1.

# interpolator call

Left for an explicit time arg. Right is for an implicit time, inferred from the args, along with an extra bit of documentation to describe it.

Arguments

 :: CallName -> (Sig.Parser arg, arg -> Curve) get args for the function and the interpolating function -> InterpolatorTime Control -> Generator Control

Use this for calls that start from the previous value, to give a way to override that behaviour.

For calls whose curve can be configured.

interpolator_variations_ :: Taggable a => (CallName -> get_arg -> InterpolatorTime a -> call) -> Expr.Symbol -> CallName -> get_arg -> [(Expr.Symbol, call)] Source #

Create the standard set of interpolator calls. Generic so it can be used by PitchUtil as well.

standard_interpolators :: (forall arg. Expr.Symbol -> CallName -> (Sig.Parser arg, arg -> Curve) -> [(Expr.Symbol, Generator result)]) -> CallMaps result Source #

# control functions

Stuff a curve function into a ControlFunction.

Convert a ControlFunction back into a curve function.

# interpolate

Given a placement, start, and duration, return the range thus implied.

Arguments

 :: SRate -> Bool include the initial sample -> Bool add a sample at end time if one doesn't naturally land there -> Curve -> RealTime.RealTime -> Signal.Y -> RealTime.RealTime -> Signal.Y -> Signal.Control

Interpolate between the given points.

# slope

Make a linear sloped line, with optional lower and upper limits. TODO I could support Curve but it would make the intercept more complicated.

# exponential

Negative exponents produce a curve that jumps from the "starting point" which doesn't seem too useful, so so hijack the negatives as an easier way to write 1/n. That way n is smoothly departing, while -n is smoothly approaching.

I could probably make a nicer curve of this general shape if I knew more math.

# bezier

guess_x :: (Double -> (Double, Double)) -> Curve Source #

As far as I can tell, there's no direct way to know what value to give to the bezier function in order to get a specific x. So I guess with binary search.

Generate a sigmoid curve. The first weight is the flatness at the start, and the second is the flatness at the end. Both should range from 0--1.

bezier3 :: Point -> Point -> Point -> Point -> Double -> Point Source #

Cubic bezier curve.

# breakpoints

Create line segments between the given breakpoints.

signal_breakpoints :: Monoid sig => ([(RealTime.RealTime, y)] -> sig) -> (RealTime.RealTime -> y -> RealTime.RealTime -> y -> sig) -> [(RealTime.RealTime, y)] -> sig Source #

distribute :: RealTime.RealTime -> RealTime.RealTime -> [a] -> [(RealTime.RealTime, a)] Source #

Distribute the values evenly over the given time range.