JSFX - CookDSP version 0.5 documentation



ALLPASS

Reverberates an input signal with a flat frequency response.

Description

Allpass is based on the combination of feedforward and feedback comb filter. This kind of filter is often used in simple digital reverb implementations.
It must be used with a variable name as prefix (object oriented).

Initializer

allpass(delay, feed)

Initializes an allpass filter with frequency as the inverse of the delay time delay, in seconds, and feedback feed, between 0 and 1.

Methods

allpass_set_delay(delay)

Sets a new delay time, in seconds.

allpass_set_feed(feed)

Sets a new feedback factor, between 0 and 1.

allpass_do(signal)

Processes one samples of an input signal signal and outputs the filtered sample.

Example

desc:Schroeder Reverb 1

import cookdsp.jsfx-inc

slider1:0.2<0,1>Balance Dry/Wet

@init
// Left ch. allpass filters     Right ch. allpass filters
a1L.allpass(0.0204, 0.35);      a1R.allpass(0.02011, 0.35);
a2L.allpass(0.06653, 0.41);     a2R.allpass(0.06641, 0.41);
a3L.allpass(0.035007, 0.5);     a3R.allpass(0.03504, 0.5);
a4L.allpass(0.023021, 0.65);    a4R.allpass(0.022987, 0.65);
// Left ch. lowpass filters     Right ch. lowpass filters
lp1L.lop(5000);                 lp1R.lop(5000);
lp2L.lop(3000);                 lp2R.lop(3000);
lp3L.lop(1500);                 lp3R.lop(1500);
lp4L.lop(500);                  lp4R.lop(500);

@sample
// Left channel                 Right channel                 
sig1L = a1L.allpass_do(spl0);   sig1R = a1R.allpass_do(spl1);
sig2L = a2L.allpass_do(sig1L);  sig2R = a2R.allpass_do(sig1R);
sig3L = a3L.allpass_do(sig2L);  sig3R = a3R.allpass_do(sig2R);
sig4L = a4L.allpass_do(sig3L);  sig4R = a4R.allpass_do(sig3R);
lop1L = lp1L.lop_do(sig1L);     lop1R = lp1R.lop_do(sig1R);
lop2L = lp2L.lop_do(sig2L);     lop2R = lp2R.lop_do(sig2R);
lop3L = lp3L.lop_do(sig3L);     lop3R = lp3R.lop_do(sig3R);
lop4L = lp4L.lop_do(sig4L);     lop4R = lp4R.lop_do(sig4R);
sigL = (lop1L + lop2L + lop3L + lop4L) * 0.5;
sigR = (lop1R + lop2R + lop3R + lop4R) * 0.5;
spl0 = spl0 + (sigL - spl0) * slider1;
spl1 =  spl1 + (sigR - spl1) * slider1;

Download example : cookdsp_allpass

See the source file : filters.jsfx-inc

(c) Olivier BĂ©langer, 2020