I am trying to implement the simplest version of Karplus-Strong algorithm using Euterpea:
My code: 0.7 seconds of white noise burst
burst :: AudSF () Double
burst = proc () -> do
burstEnv <- envLineSeg [1,1,0,0] [0.7, 0, 9.3] -< ()
noise <- noiseWhite 42 -< ()
outA -< burstEnv * noise
problematic part:
karplus :: AudSF Double Double
karplus = proc input -> do
rec filtered <- filterLowPass -< (delayed, 2000)
delayed <- delayLine 0.7 -< filtered + input
outA -< filtered + input
test1 function should create a file of 10 seconds with a few cycles:
test1 = outFile "test1.wav" 10 $ burst >>> karplus
As far as I know the feedback loop should run on and on and on.
The problem is the input is only delayed and filtered once. It's not fed to the loop again.
I suspect that the problem lies in my not understanding lazy evaluation or value passing.