0
$\begingroup$

I am probably going about this completely wrong, but I'm trying to implement a filter bank in reaper's JSFX as follows: First, split the spectrum into half (via aritmetic and a fo-lpf), then split each half in half, and etc until I have 32 bands at the right half of a buffer. The problem is, listening to the intermediary results, I seem to run into an issue when I compare the 4/8 block with the 5/8 block (buffer positions 11 and 12) - the 4/8 block sounds like the frequency content has a higher mean then the 5/8 block.

Am I going about a filter bank in the wrong method? The type of filter used is a simple one pole first order IIR.

@init
coeffs = memalloc(64);
Lbands = memalloc(64);
Rbands = memalloc(64);
top_frac = min(0.45, 20000/srate);
top_frac = min(0.45, 1500/srate);
bot_frac = 1500/srate;
bot_frac = 80/srate;

bc = 1;
loop(5,
    bi = bc;
    fi = 1;
    loop(bc,
        frac1 = (fi / bc / 2);
        frac = bot_frac + (top_frac - bot_frac) * frac1;
        coeffs[bi] = exp(-2*$pi*frac);
        bi += 1;
        fi += 2;
    );
    bc *= 2;
);

@sample
L = spl0;
R = spl1;
Lbands[1] = L;
Rbands[1] = R;
bc = 1;
loop(5,
    bi = bc;
    fi = 1;
    loop(bc,
        sampL = Lbands[bi];
        sampR = Rbands[bi];
        Lbands[2*bi] = sampL + (Lbands[2*bi] - sampL) * coeffs[bi];
        Rbands[2*bi] = sampR + (Rbands[2*bi] - sampR) * coeffs[bi];
        Lbands[2*bi+1] = sampL - Lbands[2*bi];
        Rbands[2*bi+1] = sampR - Rbands[2*bi];
        bi += 1;
        fi += 2;
    );
    bc *= 2;
);

of note: linear phase is not desired, and perfect reconstruction is nice to have, but not necessary.

$\endgroup$

1 Answer 1

0
$\begingroup$

After thinking it through, I've come up with the following solution:

Instead of having a complicated setup, let residue = the original signal. Repeat N-1 times: take the low pass filter, output that sample, and then subtract to find the residue. Finally, residue contains band N (index N-1). This seems simple enough to me, and it works for my purpose.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.