module Synthesizer.Dimensional.Rate.Control
(
constant, linear, exponential, exponential2, )
where
import qualified Synthesizer.Dimensional.Signal.Private as SigA
import qualified Synthesizer.Dimensional.Amplitude as Amp
import qualified Synthesizer.Dimensional.Rate as Rate
import qualified Synthesizer.State.Control as Ctrl
import qualified Synthesizer.State.Signal as Sig
import qualified Synthesizer.Dimensional.Process as Proc
import qualified Number.DimensionTerm as DN
import qualified Algebra.DimensionTerm as Dim
import qualified Algebra.Transcendental as Trans
import qualified Algebra.Field as Field
import qualified Algebra.Ring as Ring
import NumericPrelude.Numeric
import NumericPrelude.Base
import Prelude ()
type Signal s y = SigA.T (Rate.Phantom s) (Amp.Flat y) (Sig.T y)
constant :: (Ring.C y, Dim.C u) =>
Proc.T s u t (Signal s y)
constant = Proc.pure $ SigA.flatFromBody $ Ctrl.constant one
linear ::
(Field.C q, Dim.C u) =>
DN.T u q
-> Proc.T s u q (Signal s q)
linear dist =
fmap
(SigA.flatFromBody . Ctrl.linearMultiscaleNeutral . recip)
(Proc.toTimeScalar dist)
exponential :: (Trans.C q, Dim.C u) =>
DN.T u q
-> Proc.T s u q (Signal s q)
exponential time =
fmap
(SigA.flatFromBody . Ctrl.exponentialMultiscaleNeutral)
(Proc.toTimeScalar time)
exponential2 :: (Trans.C q, Dim.C u) =>
DN.T u q
-> Proc.T s u q (Signal s q)
exponential2 time =
fmap
(SigA.flatFromBody . Ctrl.exponential2MultiscaleNeutral)
(Proc.toTimeScalar time)