module Synthesizer.State.Filter.Recursive.Comb where
import qualified Synthesizer.State.Signal as Sig
import qualified Synthesizer.Plain.Filter.Recursive.FirstOrder as Filt1
import qualified Synthesizer.State.Filter.Delay as Delay
import qualified Algebra.Module as Module
import qualified Algebra.Ring as Ring
import qualified Algebra.Additive as Additive
import Algebra.Module((*>))
import qualified Prelude as P
import NumericPrelude.Base
import NumericPrelude.Numeric
karplusStrong :: (Ring.C a, Module.C a v) =>
Filt1.Parameter a -> Sig.T v -> Sig.T v
karplusStrong c wave =
Sig.delayLoop (Sig.modifyStatic Filt1.lowpassModifier c) wave
run :: (Module.C a v) => Int -> a -> Sig.T v -> Sig.T v
run time gain = Sig.delayLoopOverlap time (gain *>)
runMulti :: (Ring.C a, Module.C a v) => [Int] -> a -> Sig.T v -> Sig.T v
runMulti times gain x =
let y = Sig.fromList $ Sig.toList $
foldl
(Sig.zipWith (+)) x
(map (flip Delay.staticPos (gain *> y)) times)
in y
runProc :: Additive.C v => Int -> (Sig.T v -> Sig.T v) -> Sig.T v -> Sig.T v
runProc = Sig.delayLoopOverlap