module Synthesizer.State.Displacement where
import qualified Synthesizer.State.Signal as Sig
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) => Sig.T v -> Sig.T v -> Sig.T v
mix = Sig.mix
mixMulti :: (Additive.C v) => [Sig.T v] -> Sig.T v
mixMulti = foldl mix Sig.empty
raise :: (Additive.C v) => v -> Sig.T v -> Sig.T v
raise x = Sig.map ((+) x)
distort :: (c -> a -> a) -> Sig.T c -> Sig.T a -> Sig.T a
distort = Sig.zipWith
mapLinear :: (Ring.C a) =>
a ->
a ->
Sig.T a ->
Sig.T a
mapLinear depth center =
Sig.map (\x -> center*(one+x*depth))
mapExponential :: (Trans.C a) =>
a ->
a ->
Sig.T a ->
Sig.T a
mapExponential depth center =
let logDepth = log depth
in Sig.map ((center*) . exp . (logDepth*))