{-# LANGUAGE NoImplicitPrelude #-}
module Synthesizer.Causal.Interpolation (
Interpolation.T,
relative,
relativeZeroPad,
relativeConstantPad,
relativeCyclicPad,
relativeExtrapolationPad,
relativeZeroPadConstant,
relativeZeroPadLinear,
relativeZeroPadCubic,
) where
import qualified Synthesizer.Interpolation.Module as IpExample
import qualified Synthesizer.Interpolation as Interpolation
import qualified Synthesizer.State.Interpolation as InterpolationS
import qualified Synthesizer.Causal.Process as Causal
import qualified Synthesizer.State.Signal as Sig
import qualified Algebra.Module as Module
import qualified Algebra.RealField as RealField
import qualified Algebra.RealRing as RealRing
import qualified Algebra.Additive as Additive
import NumericPrelude.Numeric
import NumericPrelude.Base
{-# INLINE relative #-}
relative :: (RealRing.C t) =>
Interpolation.T t y -> t -> Sig.T y -> Causal.T t y
relative :: forall t y. C t => T t y -> t -> T y -> T t y
relative T t y
ip t
phase0 T y
x0 =
forall x acc y. (x -> acc -> Maybe (y, acc)) -> acc -> T x y
Causal.crochetL
(\t
freq (t, T y)
pos ->
let (t
phase,T y
x) = forall t y. C t => T t y -> (t, T y) -> (t, T y)
InterpolationS.skip T t y
ip (t, T y)
pos
in forall a. a -> Maybe a
Just (forall t y. T t y -> t -> T y -> y
Interpolation.func T t y
ip t
phase T y
x, (t
phaseforall a. C a => a -> a -> a
+t
freq,T y
x)))
(t
phase0,T y
x0)
{-# INLINE relativeZeroPad #-}
relativeZeroPad :: (RealRing.C t) =>
y -> Interpolation.T t y -> t -> Sig.T y -> Causal.T t y
relativeZeroPad :: forall t y. C t => y -> T t y -> t -> T y -> T t y
relativeZeroPad y
z T t y
ip t
phase T y
x =
forall t y a.
C t =>
(T t y -> t -> T y -> a) -> y -> T t y -> t -> T y -> a
InterpolationS.zeroPad forall t y. C t => T t y -> t -> T y -> T t y
relative y
z T t y
ip t
phase T y
x
{-# INLINE relativeConstantPad #-}
relativeConstantPad :: (RealRing.C t) =>
Interpolation.T t y -> t -> Sig.T y -> Causal.T t y
relativeConstantPad :: forall t y. C t => T t y -> t -> T y -> T t y
relativeConstantPad T t y
ip t
phase T y
x =
forall t y a.
C t =>
(T t y -> t -> T y -> a) -> T t y -> t -> T y -> a
InterpolationS.constantPad forall t y. C t => T t y -> t -> T y -> T t y
relative T t y
ip t
phase T y
x
{-# INLINE relativeCyclicPad #-}
relativeCyclicPad :: (RealRing.C t) =>
Interpolation.T t y -> t -> Sig.T y -> Causal.T t y
relativeCyclicPad :: forall t y. C t => T t y -> t -> T y -> T t y
relativeCyclicPad T t y
ip t
phase T y
x =
forall t y a.
C t =>
(T t y -> t -> T y -> a) -> T t y -> t -> T y -> a
InterpolationS.cyclicPad forall t y. C t => T t y -> t -> T y -> T t y
relative T t y
ip t
phase T y
x
{-# INLINE relativeExtrapolationPad #-}
relativeExtrapolationPad :: (RealRing.C t) =>
Interpolation.T t y -> t -> Sig.T y -> Causal.T t y
T t y
ip t
phase T y
x =
forall t y a.
C t =>
(T t y -> t -> T y -> a) -> T t y -> t -> T y -> a
InterpolationS.extrapolationPad forall t y. C t => T t y -> t -> T y -> T t y
relative T t y
ip t
phase T y
x
{-# INLINE relativeZeroPadConstant #-}
relativeZeroPadConstant ::
(RealRing.C t, Additive.C y) =>
t -> Sig.T y -> Causal.T t y
relativeZeroPadConstant :: forall t y. (C t, C y) => t -> T y -> T t y
relativeZeroPadConstant =
forall t y. C t => y -> T t y -> t -> T y -> T t y
relativeZeroPad forall a. C a => a
zero forall t y. T t y
IpExample.constant
{-# INLINE relativeZeroPadLinear #-}
relativeZeroPadLinear ::
(RealRing.C t, Module.C t y) =>
t -> Sig.T y -> Causal.T t y
relativeZeroPadLinear :: forall t y. (C t, C t y) => t -> T y -> T t y
relativeZeroPadLinear =
forall t y. C t => y -> T t y -> t -> T y -> T t y
relativeZeroPad forall a. C a => a
zero forall t y. C t y => T t y
IpExample.linear
{-# INLINE relativeZeroPadCubic #-}
relativeZeroPadCubic ::
(RealField.C t, Module.C t y) =>
t -> Sig.T y -> Causal.T t y
relativeZeroPadCubic :: forall t y. (C t, C t y) => t -> T y -> T t y
relativeZeroPadCubic =
forall t y. C t => y -> T t y -> t -> T y -> T t y
relativeZeroPad forall a. C a => a
zero forall t y. (C t, C t y) => T t y
IpExample.cubic