module Synthesizer.Causal.Oscillator.Core where
import qualified Synthesizer.Basic.Phase as Phase
import qualified Synthesizer.Causal.Process as Causal
import qualified Synthesizer.State.Signal as Sig
import Control.Arrow ((^<<), (&&&), second, returnA, )
import qualified Algebra.RealRing as RealRing
import NumericPrelude.Numeric
import NumericPrelude.Base
static :: RealRing.C a =>
Phase.T a -> a -> Sig.T (Phase.T a)
static phase freq =
Sig.iterate (Phase.increment freq) phase
phaseMod :: (RealRing.C a) =>
a -> Causal.T a (Phase.T a)
phaseMod freq =
uncurry Phase.increment ^<<
Causal.feedSnd (static zero freq)
shapeMod :: (RealRing.C a) =>
Phase.T a -> a -> Causal.T c (c, Phase.T a)
shapeMod phase freq =
Causal.feedSnd (static phase freq)
freqMod :: RealRing.C a =>
Phase.T a -> Causal.T a (Phase.T a)
freqMod =
Causal.scanL (flip Phase.increment)
freqModSync :: RealRing.C a =>
Phase.T a -> Causal.T a (Phase.T a)
freqModSync =
Causal.crochetL
(\f p0 -> let p1 = Phase.increment f p0 in Just (p1,p1))
freqModAntiAlias :: (RealRing.C a) =>
Phase.T a -> Causal.T a (a, Phase.T a)
freqModAntiAlias phase =
returnA &&& freqMod phase
phaseFreqMod :: (RealRing.C a) =>
Causal.T (a,a) (Phase.T a)
phaseFreqMod =
uncurry Phase.increment ^<<
second (freqMod zero)
shapeFreqMod :: (RealRing.C a) =>
Phase.T a -> Causal.T (c,a) (c, Phase.T a)
shapeFreqMod phase =
second (freqMod phase)