{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE FlexibleInstances #-}
module Synthesizer.Plain.Filter.Recursive.Comb where
import qualified Synthesizer.Plain.Filter.Recursive.FirstOrder as Filt1
import qualified Synthesizer.Plain.Signal as Sig
import qualified Synthesizer.Plain.Control as Ctrl
import Synthesizer.Plain.Filter.NonRecursive (delay, )
import qualified Algebra.Module as Module
import qualified Algebra.Ring as Ring
import qualified Algebra.Additive as Additive
import NumericPrelude.Numeric
import NumericPrelude.Base
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