module Synthesizer.Plain.Filter.Delay.List where
import qualified Synthesizer.Plain.Interpolation as Interpolation
import qualified Algebra.RealField as RealField
import qualified Algebra.Additive as Additive
import Data.List(tails)
import qualified Prelude as P
import NumericPrelude.Base
import NumericPrelude.Numeric
modulatedRevCore :: (RealField.C a, Additive.C v) =>
Interpolation.T a v -> Int -> [a] -> [v] -> [v]
modulatedRevCore ip size ts xs =
zipWith
(\t x ->
let (ti,tf) = splitFraction t
in Interpolation.func ip tf (drop ti x))
ts (drop size (scanl (flip (:)) [] xs))
modulatedRev :: (RealField.C a, Additive.C v) =>
Interpolation.T a v -> Int -> [a] -> [v] -> [v]
modulatedRev ip maxDelay ts xs =
let size = maxDelay + Interpolation.number ip
in modulatedRevCore ip
(size + 1 + Interpolation.offset ip)
ts
(replicate size zero ++ xs)
modulatedCore :: (RealField.C a, Additive.C v) =>
Interpolation.T a v -> Int -> [a] -> [v] -> [v]
modulatedCore ip size ts xs =
zipWith
(\t x ->
let (ti,tf) = splitFraction (t)
in Interpolation.func ip tf (drop (size+ti) x))
ts (tails xs)
modulated :: (RealField.C a, Additive.C v) =>
Interpolation.T a v -> Int -> [a] -> [v] -> [v]
modulated ip maxDelay ts xs =
let size = maxDelay + Interpolation.number ip
in modulatedCore ip
(size Interpolation.offset ip)
ts
(replicate size zero ++ xs)