Cabbage Logo
Back to Cabbage Site

Filter implementation

Hi!
Im attempting to make a sort of ‘Specialized EQ’ kinda plugin.
Attatched is an image, sort of showing the function. ~24 bands that create resonances similar to a comb filter, but with these resonances in a specific scale. I have an idea on how to do it, involving setting individual resonances on the keys of the scale, since i would like to be able to control width of the individual bands, however, this seems like it would be not only high on cpu, but i cant seem to find an opcode that functions like this. Any suggestions?

Can you not just set up 24 band-pass filters across the frequency range? Some of the opcodes below might help, but there are loads of other filters that might be useful.

areson
reson
streson

Im gonna be honest, i thought about that, but my train of thought was ‘If i pass it from the first band to the second, there’s no audio for it to do anything because the first one already filtered it out!’ but I didnt realize i could pass the original sound into all filters. I do now have a question about the frequencies of the filters though. Since im using a combobox to determine the key of the frequencies, the easiest way to do it would be to make a variable (kBand1, kBand2, etc.) for each band, then create a massive if/else chain for the values, for each band

If kKey==1 then
kBand1 = 440
kBand2 = 493.88
*repeats for all 24
elseif kKey==2 then
kBand1 = 466.16
*repeats for all 24

this would be massively inefficient though. Would there be any better way of doing this or is this the best option?

EDIT: thought i should mention i have all 12 major AND minor keys, leading to 24 total keys i would need to do this process for leading to ~600 lines of code to specify all the frequencies

This is known as a parallel filter chain, as opposed to cascading, and it’s great for things like formants.

Better to simple pass the kKey variable directly to the filter.