{"name":"bouncy-ball delay","is_private":null,"id":"1-56v","author":"snappizz","ancestor_list":[],"description":"delay effect with accelerating echoes","has_audio":false,"labels":["delay","bouncy","ball","effect"],"code":"~buf = Buffer.alloc(s, s.sampleRate * 5);\r\n\r\n(\r\n{\r\n    var trig, freq;\r\n    var dry, snd, phase, iois;\r\n    var cumulDelay;\r\n    var decayFactor, lpfCutoff, numEchoes, ioiScale, ioiDecayFactor;\r\n\r\n    // play with these!\r\n    decayFactor = 0.65;\r\n    lpfCutoff = 500;\r\n    numEchoes = 16;\r\n    ioiScale = 0.4;\r\n    ioiDecayFactor = 0.75;\r\n\r\n    // example input -- you can substitute other stuff here\r\n    trig = Dust.ar(1);\r\n    dry = Pulse.ar(100 * TIRand.ar(1, 12, trig));\r\n    dry = dry * Decay2.ar(trig, 0.01, 0.2);\r\n\r\n    phase = DelTapWr.ar(~buf, dry);\r\n    iois = Array.geom(numEchoes, ioiScale, ioiDecayFactor);\r\n    cumulDelay = iois.sum;\r\n    (cumulDelay > ~buf.duration).if {\r\n        Error(\"use a larger buffer\").throw;\r\n    };\r\n    snd = Silent.ar;\r\n    iois.reverse.do { |ioi|\r\n        snd = (snd + DelTapRd.ar(~buf, phase, cumulDelay, interp: 4)) * decayFactor;\r\n        // one-pole lowpass -- LPF was too aggressive\r\n        snd = OnePole.ar(snd, lpfCutoff / SampleRate.ir);\r\n        cumulDelay = cumulDelay - ioi;\r\n    };\r\n    snd = snd + dry;\r\n    \r\n    snd * 0.5!2;\r\n}.play;\r\n\r\n// contributors so far: Nathan Ho\r\n)"}