# Frequency-domain impact of non-linear filters

DSP, Plug-in and Host development discussion.
KVRist
52 posts since 5 Jul, 2018 from Cambridge, UK
All the discussions I've come across about analogue-modelled filters with non-linear properties have focused on the time-domain calculation.

Is there any analysis of what these filters do in the frequency-domain, even in a static state?

Non-linear time-domain effects like waveshaping or ring-modulation have well-defined frequency-domain consequences (even if it wouldn't make sense to ever calculate them like that). But I don't have a good feel for what a "dirty filter" would do.

KVRian
885 posts since 31 Dec, 2008
The problem with frequency domain analyses is that there's little you can do with it if the system is not LTI (Linear Time Invariant). Transfer functions don't work there AFAIK (If NOT LTI).

KVRist

Topic Starter

52 posts since 5 Jul, 2018 from Cambridge, UK
You can still talk about (some) non-LTI systems in frequency-domain terms. As I mentioned, you can say useful things about the frequencies added by waveshaping, and that's definitely not linear.

Choruses aren't time-invariant, but you can get an intuitive grasp of what they do spectrally (spreading each frequency into a narrow band proportional to the base frequency). There are even some things you can say about FM, at least when the carrier/modulator are simple.

The answer could still be no, 'dirty filters' are mysterious and unknowable - but just not being LTI isn't enough to make it a dead-end.

KVRAF
6370 posts since 12 Feb, 2006 from Helsinki, Finland
Isn't "dirty filter" usually a matter of waveshaping inside the filter? So you can take a power-series expansion of the non-linearity and then treat it as convolution of the spectrum. It doesn't result in any math that is particularly easy to work with, but it should at least help gain some intuitive understand of what is going on.
Preferred pronouns would be "it/it" because according to this country, I'm a piece of human trash.

KVRist

Topic Starter

52 posts since 5 Jul, 2018 from Cambridge, UK
I did wonder, yeah - but one of the few graphs I saw showed it adding new frequencies to an entirely tonal input. (I can't find it now, which is really bugging me - it was a spectrogram of a filter-sweep in some paper. I hope I'm not mis-remembering...)

For a tonal input, a pure waveshaper would have only added frequencies at existing (integer) harmonics. So it made me think there was something else going on.

KVRAF
6370 posts since 12 Feb, 2006 from Helsinki, Finland
signalsmith wrote:
Tue Apr 20, 2021 12:18 pm
I did wonder, yeah - but one of the few graphs I saw showed it adding new frequencies to an entirely tonal input. (I can't find it now, which is really bugging me - it was a spectrogram of a filter-sweep in some paper.)
Well, sweeping a filter amounts to varying phase-shift which is the same thing as varying delay, which means you have FM... but actually you don't always even need that, because a non-linearity itself can "modulate" a filter in such a way that the phase-shifts end up varying. It only takes a relatively simple system to get "chaos" and that stuff is not exactly "pleasant" mathematically.

But like.. isolated a waveshaper is still a waveshaper.
Preferred pronouns would be "it/it" because according to this country, I'm a piece of human trash.

KVRist

Topic Starter

52 posts since 5 Jul, 2018 from Cambridge, UK
Sorry, I should have been clearer - it was a very slow sweep, so you basically got a series of steady-states. It showed clear patterns as it introduced new frequencies, in a kind of "starburst" pattern as the cutoff (slowly) changed.

There's probably not much use trying to talk about this unless I can find some actual examples. If I manage to come across it again, I'll come back.

KVRAF
6370 posts since 12 Feb, 2006 from Helsinki, Finland
signalsmith wrote:
Tue Apr 20, 2021 12:53 pm
Sorry, I should have been clearer - it was a very slow sweep, so you basically got a series of steady-states. It showed clear patterns as it introduced new frequencies, in a kind of "starburst" pattern as the cutoff (slowly) changed.
Most "starburst" patterns on slow filters sweeps are just aliasing.

edit: Actually if you have a resonant filter (ie. complex poles), then another common reason for "starburst" patterns would be intermodulation distortion between the input harmonics and the filter resonance.
Preferred pronouns would be "it/it" because according to this country, I'm a piece of human trash.

KVRian
1296 posts since 12 Apr, 2002
LTI property is a crucial feature of a filter. Strictly speaking I don't think we can even correctly refer to a non-LTI system as a filter. A filter by definition works on the signal's spectrum, which, by definition, denies any time-domain locality (hence time invariance). Non linearities generate spectral partials at places where they originally didn't exist, hence not a filtering action either.

Thus, the term "non-linear filter" or "modulated filter" is an oxymoron, in a strict sense. When we say things like that, it can mean different things (depending on how far our actual processing deviates from LTI)
- the non-LTI effects are minor, or at least we are willing to ignore them, and treat the process as being "approximately a filter"
- the non-LTI effects are major and cannot be ignored, however the underlying design is still pretty much one of a filter (and will function as a filter if we turned off the non-LTI aspects), in which case we are probably referring to the process as a filter just to describe it somehow by referring to it's "LTI roots".

Hence it's very difficult to study non-LTI properties of the "filters", since being non-LTI contradicts the very definition of a filter. In some cases there are shortcuts, the most common one being modulation of the cutoff in continuous time, given the cutoff is implemented as integrator pre-gains. In that case modulation can be reexpressed as time warping, and the process is fully LTI in this warped time.

Waveshapers are a much more difficult story. Spectral description of waveshapers still has quite some questions for me, e.g. how to predict which new partials are going to be generated. Yeah, yeah, expand into Taylor series, blah blah, but you know what, real-world nonlinearities do not necessarily have converging Taylor series. E.g. tanh converges only up to pi/2 or smth like that. So the argument doesn't hold for signals of higher amplitude.

Maybe there is some research on this topic (I assume there should be), but I haven't heard of any prominent and widely-usable results. Maybe I simply missed those.

KVRAF
6370 posts since 12 Feb, 2006 from Helsinki, Finland
Z1202 wrote:
Tue Apr 20, 2021 10:19 pm
LTI property is a crucial feature of a filter.
Oh come on. The concept of a "filter" is common usage is way more general than that, even in the field of signal processing.

In practice the word "filter" is commonly used to refer to just about any kind of process that selectively removes "some stuff" while leaving "other stuff" untouched. For example "median filter" is clearly a filter (even though it's about as linear as a Heaviside step) because it removes outliers from data, while preserving (to a large extent) the general trend. Or you can try telling the control systems people that a Kalman filter isn't a filter because it isn't LTI and see how they react. There are also concepts such as "trans-linear filters" that are non-linear systems that appear linear in terms of their input/output characteristics. Yet more generally things like a function that takes a string and removes all instances of the letter 'a' are commonly called a filters. If anything, a concept such as an "all-pass filter" really is a misnomer as it doesn't "filter" anything from the signal.

If you want to talk about LTI systems, then talk about LTI systems. In common usage the word "filter" is way more general than that.
Preferred pronouns would be "it/it" because according to this country, I'm a piece of human trash.

KVRian
1296 posts since 12 Apr, 2002
Ok, correcting myself a bit. As long as we talk about lowpass, or bandpass or highpass etc. filters, implying that what's being filtered is the signal's spectrum

KVRist

Topic Starter

52 posts since 5 Jul, 2018 from Cambridge, UK
This feels like arguing about whether tomato is a fruit. If we need to, for this discussion we can define TWCGB to mean Things Which Can Go "Byowm", a category which includes things like diode ladders. These are colloquially described as filters, even if they don't match all the technical descriptions.
mystran wrote:
Tue Apr 20, 2021 1:32 pm
edit: Actually if you have a resonant filter (ie. complex poles), then another common reason for "starburst" patterns would be intermodulation distortion between the input harmonics and the filter resonance.
This sounds promising. This implies that if you have a 200Hz input and a very resonant TWCGB with a cutoff at 210Hz, you could expect stuff at 190 and 220, etc.

KVRian
1296 posts since 12 Apr, 2002
signalsmith wrote:
Wed Apr 21, 2021 4:29 am
This feels like arguing about whether tomato is a fruit.
I really hope my argument was not taken as arguing about terminology. I used the "misnomer" idea just to better illustrate the point I was making.

KVRian
1296 posts since 12 Apr, 2002
signalsmith wrote:
Wed Apr 21, 2021 4:29 am
This sounds promising. This implies that if you have a 200Hz input and a very resonant TWCGB with a cutoff at 210Hz, you could expect stuff at 190 and 220, etc.
I'm not sure about the exact math, whether it's exactly IDM, or just IDM-like behavior, that'd require some theoretical model of that, and I'm not aware of such models. But one thing I noticed (not 100% sure) is the "locking" of the input frequency to the resonance in strong resonance nonlinear filters. Basically, once the input frequency gets closer to the resonance it gets "pulled" all the way towards the resonant frequency. But I'm not sure if it wasn't the spectrogram resolution issue or whether it was the other way around (the resonance being pulled towards the input frequency).

KVRist

Topic Starter

52 posts since 5 Jul, 2018 from Cambridge, UK
Hmm, yeah. I have seen that (input frequencies pulled towards a resonance), and it isn't easily described by "simple" cross-modulation.