synthesizer-inference-0.2: src/Synthesizer/SampleRateContext/Displacement.hs
{- |
Copyright : (c) Henning Thielemann 2008
License : GPL
Maintainer : synthesizer@henning-thielemann.de
Stability : provisional
Portability : requires multi-parameter type classes
-}
module Synthesizer.SampleRateContext.Displacement (
mix, mixVolume,
mixMulti, mixMultiVolume,
raise,
) where
import qualified Synthesizer.Amplitude.Displacement as MiscV
import qualified Synthesizer.SampleRateContext.Signal as SigC
import qualified Synthesizer.SampleRateContext.Rate as Rate
-- import Synthesizer.SampleRateContext.Signal (toAmplitudeScalar)
-- import qualified Synthesizer
import qualified Algebra.OccasionallyScalar as OccScalar
import qualified Algebra.Module as Module
-- import qualified Algebra.Transcendental as Trans
import qualified Algebra.Field as Field
import qualified Algebra.Real as Real
-- import qualified Algebra.Ring as Ring
-- import qualified Algebra.Additive as Additive
-- import Algebra.Module ((*>))
import PreludeBase
-- import NumericPrelude
import Prelude ()
{- * Mixing -}
{-| Mix two signals.
In opposition to 'zipWith' the result has the length of the longer signal. -}
mix :: (Real.C y', Field.C y', Module.C y yv, OccScalar.C y y') =>
Rate.T t t'
-> SigC.T y y' yv
-> SigC.T y y' yv
-> SigC.T y y' yv
mix = Rate.pure MiscV.mix
mixVolume ::
(Real.C y', Field.C y', Module.C y yv, OccScalar.C y y') =>
y'
-> Rate.T t t'
-> SigC.T y y' yv
-> SigC.T y y' yv
-> SigC.T y y' yv
mixVolume v = Rate.pure $ MiscV.mixVolume v
{-| Mix one or more signals. -}
mixMulti ::
(Real.C y', Field.C y', Module.C y yv, OccScalar.C y y') =>
Rate.T t t'
-> [SigC.T y y' yv]
-> SigC.T y y' yv
mixMulti = Rate.pure MiscV.mixMulti
mixMultiVolume ::
(Real.C y', Field.C y', Module.C y yv, OccScalar.C y y') =>
y'
-> Rate.T t t'
-> [SigC.T y y' yv]
-> SigC.T y y' yv
mixMultiVolume v = Rate.pure $ MiscV.mixMultiVolume v
{-| Add a number to all of the signal values.
This is useful for adjusting the center of a modulation. -}
raise :: (Field.C y', Module.C y yv, OccScalar.C y y') =>
y'
-> yv
-> Rate.T t t'
-> SigC.T y y' yv
-> SigC.T y y' yv
raise y' yv = Rate.pure $ MiscV.raise y' yv