module Synthesizer.Plain.Filter.Recursive.Comb where
import Synthesizer.Plain.Filter.NonRecursive (delay, )
import qualified Synthesizer.Plain.Filter.Recursive.FirstOrder as Filt1
import qualified Synthesizer.Plain.Signal as Sig
import qualified Synthesizer.Plain.Control as Ctrl
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 PreludeBase
import NumericPrelude
karplusStrong :: (Ring.C a, Module.C a v) =>
Filt1.Parameter a -> Sig.T v -> Sig.T v
karplusStrong c wave =
let y = wave ++ Filt1.lowpass (Ctrl.constant c) y
in y
run :: (Module.C a v) => Int -> a -> Sig.T v -> Sig.T v
run time gain x =
let y = zipWith (+) x (delay time (gain *> y))
in y
runMulti :: (Ring.C a, Module.C a v) => [Int] -> a -> Sig.T v -> Sig.T v
runMulti time gain x =
let y = foldl (zipWith (+)) x (map (flip delay (gain *> y)) time)
in y
runProc :: Additive.C v => Int -> (Sig.T v -> Sig.T v) -> Sig.T v -> Sig.T v
runProc time feedback x =
let y = zipWith (+) x (delay time (feedback y))
in y