Is there something special about Reaktor 1 pole HP/LP filter?

DSP, Plug-in and Host development discussion.
User avatar
KVRAF
3114 posts since 28 Jan, 2006 from Phoenix, AZ

Post Wed Apr 14, 2021 8:07 pm

I am trying to translate my reaktor patch to C++ but it is not sounding the same. The culprit seems to be the HP/LP 1 pole filter.

Does anyone know anything about this filter so that I could recreate it in C++? Is there a Core Cell version that I could open up?

The filter I am referring to is the one built in, not a core cell, not an external, etc. Built-in Module -> Filter -> HP/LP 1-pole is how you get to it.

KVRian
654 posts since 21 Feb, 2006 from FI

Post Wed Apr 14, 2021 9:48 pm

Architeuthis wrote:
Wed Apr 14, 2021 8:07 pm
I am trying to translate my reaktor patch to C++ but it is not sounding the same. The culprit seems to be the HP/LP 1 pole filter.

...
Have you tried plot (mag/pha) responses of those?

User avatar
KVRAF
3927 posts since 8 Mar, 2004 from Berlin, Germany

Post Wed Apr 14, 2021 10:59 pm

a wild guess: i could imagine that reaktor uses a different discretization method than your code - for example bilinear transform instead of impulse invariant transform. if you are using the 1-poles from my library, you have actually both options there (i tend to use IIT by default, but from what i have gathered here over years, Vadim prefers BLT due to its rigid relationship between magnitude and phase)

User avatar
KVRAF

Topic Starter

3114 posts since 28 Jan, 2006 from Phoenix, AZ

Post Thu Apr 15, 2021 2:18 am

thank F***ING GOD thank you Robin, so happy you stumbled upon this thread, dunno what I would have done without your response, you don't know how relieved I am to have figured this out.

Looks like IIT is the ticket.

What I am working on is best sounding analog-style filter I've heard, I'm releasing it for free tomorrow in the Flower Child beta. It's really simple, just two IIT lowpass filters fed back into a particular waveshaper where I spent days perfecting all the parameterization and scaling of parameters over frequency and resonance and what not, I don't want to give away the secret sauce at the moment, but oh my god I was very depressed that I might not be able to get it out of Reaktor. 90% confident my C++ performs exactly like Reaktor.

User avatar
KVRAF

Topic Starter

3114 posts since 28 Jan, 2006 from Phoenix, AZ

Post Thu Apr 15, 2021 2:28 am

This begs the question, why is IIT better than BLT in this case? The difference in sound is that... IIT has constant resonance over frequency, BLT resonance increases in a displeasing way over frequency and then explodes. It could be that I just geared my values to work with IIT, but I don't even know if I could get BLT to work, I did try a bit.

User avatar
KVRAF
3927 posts since 8 Mar, 2004 from Berlin, Germany

Post Thu Apr 15, 2021 4:47 am

oh - so you actually were using BLT before and now switched to IIT and that works better? that's kinda the other way around from what i had in mind with my guess, but whatever. if you are tuning the feedback gain manually as function of the cutoff so as to achieve a uniform resonance over frequency sweeps, i can imagine that BLT behaves more bitchy towards high frequencies due to the frequency warping effects which become more severe when the cutoff approaches the nyquist limit

User avatar
KVRAF
3927 posts since 8 Mar, 2004 from Berlin, Germany

Post Thu Apr 15, 2021 4:56 am

btw: if constant resonance over frequency sweeps is the goal, i'd probably try to use custom formulas instead of BLT or IIT. i derived the relevant formula for a 4-stage filter here:

http://www.rs-met.com/documents/dsp/Res ... Filter.pdf

if i'm not mistaken, if your filter is a 2-stage, then just the t = tan((w_c - pi) / 4) must be replaced by t = tan((w_c - pi) / 2) in formula 11 and k = r/(g1^2)^2 = r/g1^4 must be replaced by k = r/g1^2 in formula 15. ...but i could be wrong - take it with a grain of salt

User avatar
KVRAF

Topic Starter

3114 posts since 28 Jan, 2006 from Phoenix, AZ

Post Thu Apr 15, 2021 6:52 am

Actually, without the IIT filters in the feedback path, the code still functions as an analog style filter with good resonance response over frequency. The problem is that it sounds tinny at lower cutoffs OR if you don't want a tinny sound then you have to increase the feedback distortion by lowering the "metaphorical voltage rails" so it clips sooner, which sounds nice, but I really wanted a clean filter this time.

So! IIT filters are not being used to filter the input signal so much, it's actually there to purify the feedback path (purer resonant tone) so you get the best of both worlds, warm low end and clean resonance, and as a side-effect, overdriving the input sounds better.

Since I've been experimenting with feedback for years now, I have some intuition in how to go about creating specific tones and behaviors. I will make a bold claim that I can recreate/imitate any analog filter by ear (it won't be perfect), and invent new ones. The possibilities are endless. For example, I've made a filter that has downsampling in the feedback path which creates pleasing fuzz. I will be doing more of these downsampled filters in the future, I'm just scratching the surface.

I'll keep those equations in mind for future exploration.

Here's some samples of my recent work:

Using IIT filters: https://www.elanhickler.com/transfer/so ... filter.mp3

Polivoks-like: https://www.elanhickler.com/transfer/so ... ttempt.mp3

Downsampled: https://www.elanhickler.com/transfer/so ... filter.mp3

User avatar
KVRAF
3927 posts since 8 Mar, 2004 from Berlin, Germany

Post Fri Apr 16, 2021 11:02 pm

Music Engineer wrote:
Thu Apr 15, 2021 4:56 am
...but i could be wrong
just a little update: i tried it. the generalization of the formulas for an N-stage ladder

t = tan((w_c - pi) / N)
k = r/g1^N

seems to work only for N >= 3. ...i'm trying to figure out, why that is...edit: aaah! i see: the phase response of a 1-pole approaches only -90° as f goes to infinity (in the analog case), so for the 2-pole, the -180° frequency is at infinity (i thought, the values would be twice that - i should look at phase responses more often). it could probably be made to work with an additional allpass in the feedback loop. ...and that would actually offer the possibility to tune the resonance further - independently from the cutoff.

KVRAF
6316 posts since 12 Feb, 2006 from Helsinki, Finland

Post Sat Apr 17, 2021 8:28 am

Music Engineer wrote:
Fri Apr 16, 2021 11:02 pm
Music Engineer wrote:
Thu Apr 15, 2021 4:56 am
...but i could be wrong
just a little update: i tried it. the generalization of the formulas for an N-stage ladder

t = tan((w_c - pi) / N)
k = r/g1^N

seems to work only for N >= 3. ...i'm trying to figure out, why that is...edit: aaah! i see: the phase response of a 1-pole approaches only -90° as f goes to infinity (in the analog case), so for the 2-pole, the -180° frequency is at infinity (i thought, the values would be twice that - i should look at phase responses more often). it could probably be made to work with an additional allpass in the feedback loop. ...and that would actually offer the possibility to tune the resonance further - independently from the cutoff.
Right, so the feedback in the case of the 4-pole is based on the idea that four poles give you total 2*pi phase-shift at infinity and the half-way point (=pi) is at cutoff, so when you invert the feedback the cutoff is in phase.

That said, you CAN build arbitrary responses (of a given order) with any number of poles cascaded like in a ladder, you just have to take a combination of the output from multiple poles for use as feedback. The idea that you can do this to place the zeroes where you want is well-known (ie. the "Xpander modes"), but you can also do a similar thing with the feedback signal. For example, in the case of a 2-pole, taking the difference between the first and second pole (check the math yourself, I'm writing this from memory and there might be some detail I'm forgetting) will get you a filter that is essentially a transposed Sallen-Key. I personally don't think non-linearities in the style of transistor-ladder necessarily sound great with such filters (eg. OTA-style cascade like in Xpander tends to work better for these), but they certainly work.
Preferred pronouns would be "it/it" because according to this country, I'm a piece of human trash.

User avatar
KVRAF
3927 posts since 8 Mar, 2004 from Berlin, Germany

Post Sat Apr 17, 2021 10:48 am

mystran wrote:
Sat Apr 17, 2021 8:28 am
That said, you CAN build arbitrary responses (of a given order) with any number of poles cascaded like in a ladder, you just have to take a combination of the output from multiple poles for use as feedback.
that is indeed an interesting idea that i may explore at some point! the ladder is a very flexible and versatile basic structure on top of which a lot of interesting stuff can be built!

oh and another note: i only realized later that the expression for the compensation gain can be simplified much further. at the end, the required compensation gain comes out as just 1+k. i really should update the pdf to add that. this whole "evaluate the polynomial via Horner's rule" stuff is obsolete
Last edited by Music Engineer on Sat Apr 17, 2021 1:12 pm, edited 1 time in total.

KVRian
654 posts since 21 Feb, 2006 from FI

Post Sat Apr 17, 2021 1:09 pm

This LPF1 (MZT) may give closer to analog response than IIM (IIT?) ... ? :

Code: Select all

Approximated LPF1

p1 = (fc*(19.7392*fc + 6.28319*fs))/fs^2 + 1;

a0 = 1.0;
a1 = -p1;
b0 =  a0+a1; 
b1 = 0;
Comparison plot in attachments.
You do not have the required permissions to view the files attached to this post.

Return to “DSP and Plug-in Development”