{-# LANGUAGE NoImplicitPrelude #-}
module Synthesizer.Causal.Displacement where

import qualified Synthesizer.Causal.Process as Causal

import qualified Algebra.Additive              as Additive

import qualified Prelude as P
import PreludeBase
import NumericPrelude


{- * Mixing -}

{-|
Mix two signals.
Unfortunately we have to use 'zipWith' semantic here,
that is the result is as long as the shorter of both inputs.
-}
{-# INLINE mix #-}
mix :: (Additive.C v) => Causal.T (v,v) v
mix = Causal.map (uncurry (+))


{-|
Add a number to all of the signal values.
This is useful for adjusting the center of a modulation.
-}
{-# INLINE raise #-}
raise :: (Additive.C v) => v -> Causal.T v v
raise x = Causal.map (x+)


{- * Distortion -}
{-|
In "Synthesizer.Basic.Distortion" you find a collection
of appropriate distortion functions.
-}
{-# INLINE distort #-}
distort :: (c -> a -> a) -> Causal.T (c,a) a
distort f = Causal.map (uncurry f)