module Synthesizer.Causal.Displacement where
import qualified Control.Arrow as A
import qualified Algebra.Transcendental as Trans
import qualified Algebra.Ring as Ring
import qualified Algebra.Additive as Additive
import NumericPrelude.Numeric
import NumericPrelude.Base
mix :: (Additive.C v, A.Arrow arrow) => arrow (v,v) v
mix = A.arr (uncurry (+))
raise :: (Additive.C v, A.Arrow arrow) => v -> arrow v v
raise x = A.arr (x+)
distort :: (A.Arrow arrow) => (c -> a -> a) -> arrow (c,a) a
distort f = A.arr (uncurry f)
mapLinear :: (Ring.C a, A.Arrow arrow) =>
a ->
a ->
arrow a a
mapLinear depth center =
A.arr (\x -> center*(one+x*depth))
mapExponential :: (Trans.C a, A.Arrow arrow) =>
a ->
a ->
arrow a a
mapExponential depth center =
let logDepth = log depth
in A.arr ((center*) . exp . (logDepth*))