3
$\begingroup$

I am curious about software implementation of analog filters. For example, let's say I have a moog low pass filter. What should I do to turn this device into satisfactory, analog sounding software.

I don't actually want programming advice(doesn't mean I won't be grateful if given), what I want is to know what coefficients, parameters I need to extract from this device to write this program and how am I supposed to extract them.

If I want to write a program that behaves exactly the same as the device, what method would you suggest?

Do you think changing the variables such as cutoff, resonance, eg amount etc. continuously on the device and collect values ​​for all combinations of parameter configurations while sending some sort of input to the device would get me through response of the filter? If so, how should I use these collected values ​​while recreating the analog device programmatically?

All of the assumptions I made above may be wrong, any guidance is welcomed. Thanks in advance.

PS: Looks like I wasn't clear enough about the linear/non-linear characteristics. EDIT: The desired modeling implied in this question includes the non-linear characteristic as well as linear.

$\endgroup$
7
  • $\begingroup$ I'm confused about how will you get over the Nyquist limitation, but also about "satisfactory, analog sounding software". $\endgroup$ Jan 25 at 18:17
  • $\begingroup$ Hi! @aconcernedcitizen I'm sorry if what I'm trying to say isn't clear enough for you, I meant a decent modeling that can mimic the so to say "warmth" in analog devices. This is not an area I am very experienced in, What do you mean by the nyquist limitation exactly, can you elaborate a bit further? $\endgroup$ Jan 25 at 18:28
  • $\begingroup$ There's a great chance that my English is that bad, so no need for sorry. But now that you say "warmth", I have to wonder if what you really mean is the effect of the tube amplifiers? That's just some tanh() limitation (soft clipping), so it's not about filtering as much as distortion. You can get away cheaper with soft limiters, of various degrees. Also, for me it would not be "warmth", but rather "metallic", but now we're talking about perception. $\endgroup$ Jan 25 at 19:54
  • $\begingroup$ Now I realize I have always paired the analog warmth with two things in my head(even though there is probably no such straight relationship between them): 1- passive circuit elements. 2- lack of definitiveness found in digital models. Putting all semantics and linguistics aside, basically what I'm trying to say is I want to develop a realistic software that avoids the precision of digital modeling. It's like designing a filter with a 3dB roll off rather than a filter that cuts off when the cutoff frequency is reached. $\endgroup$ Jan 25 at 20:27
  • 1
    $\begingroup$ Well, for the 1st point, passive elements are as linear as they get (not quite but, details), and for the 2nd, it must be my English, again ("definitiveness"?). At any rate, as you say, semantics aside, if you think a 3 dB/oct filter is much easier in DSP than analog, you're in for a surprize: you'll have to apply about the same tactics as in the analog world: combine poles/zeroes until you get an acceptable enough rolloff. It will be less prone to temperature/tolerance/etc errors, though. $\endgroup$ Jan 25 at 20:43

3 Answers 3

4
$\begingroup$

Modeling real analog components with their non-linear behavior can be a challenge to do digitally. I suggest starting with wave digital filters. Quoting from the linked source:

A Wave Digital Filter (WDF)is a particular kind of digital filter based on physical modeling principles. Unlike most digital filter types, every delay element in a WDF can be interpreted physically as holding the current state of a mass or spring (or capacitor or inductor). WDFs can also be viewed as a particular kind of finite difference scheme having unusually good numerical properties. ... WDFs have been applied often in music signal processing.

In addition to linear applications there are ways to model non-linear devices with this structure as you would need for your application. A basic component of filters and amplifying structures are three terminal devices. A particularly recent reference is Wave Digital Modeling of Nonlinear 3-terminal Devices for Virtual Analog Applications.

As an example, this paper presents as an example modeling this amplifier circuit: Example guitar pre-amplifier circuit

arriving at the following wave digital implementation: enter image description here

You may also be interested in Enhanced Wave Digital Triode Model for Real-Time Tube Amplifier Emulation(sorry for the paywall) and Virtual Analog Modeling in the Wave-Digital Domain.

Some additional resources I found related to the original question:

$\endgroup$
1
  • $\begingroup$ Very relevant and useful! $\endgroup$
    – Jazzmaniac
    Jan 26 at 9:59
2
$\begingroup$

I try to describe the linear filter aspects of the 4-pole Moog.

The 4-pole Moog filter is a cascade of four 1-pole LPF filters that have resonant frequency adjustable and a feedback path that has the feedback gain adjustable (on the patchboard Moog synths, this feedback gain knob was labeled "Regeneration"). The resonant frequency filters is adjustable with voltage control (they're a "VCF") that had the control voltage scaled the same as the VCO. If the Regeneration knob was cranked up high enough, the filter naturally oscillated and then the only thing that keeps the amplitude from increasing without bound in a runaway manner is the nonlinearity of the system.

This answer does not deal with the nonlinear description.

In the analog, continuous-time universe, a simple 1-pole filter looks like:

$$ H_1(s) = \frac{1}{1 + \frac{s}{2 \pi f_0}} $$

where $f_0$ is the -3 dB corner frequency of the 1-pole filter. Without feedback, four of these identical filters in series have a transfer function that looks like:

$$\begin{align} H_4(s) &= \big( H_1(s) \big)^4 \\ \\ &= \left( \frac{1}{1 + \frac{s}{2 \pi f_0}} \right)^4 \\ \end{align}$$

Now, if you put in a little negative feedback with "regenerative gain" $G_\mathrm{R}$, in the Laplace Transform domain, the signal path is described by:

$$ Y(s) = H_4(s) \big(X(s) - G_\mathrm{R} Y(s) \big)$$

where $X(s)$ is the transform of the input and $Y(s)$ is the transform of the output. We want to solve for $Y(s)$.

$$\begin{align} Y(s) + H_4(s) G_\mathrm{R} Y(s) &= H_4(s) X(s) \\ \\ Y(s) \big(1 + H_4(s) G_\mathrm{R} \big) &= H_4(s) X(s) \\ \\ Y(s) &= \frac{H_4(s)}{1 + H_4(s) G_\mathrm{R}} X(s) \\ \end{align}$$

The transfer function is whatever multiplies $X(s)$.

$$\begin{align} H(s) &= \frac{Y(s)}{X(s)} \\ \\ &= \frac{\left( \frac{1}{1 + \frac{s}{2 \pi f_0}} \right)^4}{1 + G_\mathrm{R} \left( \frac{1}{1 + \frac{s}{2 \pi f_0}} \right)^4 } \\ \\ &= \frac{1}{\left( 1 + \frac{s}{2 \pi f_0} \right)^4 + G_\mathrm{R} } \\ \\ \end{align}$$

The poles of $H(s)$ are whatever values of $s$ that make the denominator go to zero.

$$\begin{align} 0 &= \left( 1 + \frac{s}{2 \pi f_0} \right)^4 + G_\mathrm{R} \Big|_{s = p} \\ \\ \left( 1 + \frac{p}{2 \pi f_0} \right)^4 &= -G_\mathrm{R} \\ \\ \left( 1 + \frac{p_n}{2 \pi f_0} \right)^4 \left(e^{-j 2\pi \frac{n}{4}} \right)^4 &= -G_\mathrm{R} \qquad \qquad \qquad n \in \mathbb{Z} \\ \\ \left( 1 + \frac{p_n}{2 \pi f_0} \right)^4 &= (-1)G_\mathrm{R} \left(e^{j 2\pi \frac{n}{4}} \right)^4 \\ \\ 1 + \frac{p_n}{2 \pi f_0} &= (-1)^{\frac{1}{4}}\big(G_\mathrm{R}\big)^{\frac{1}{4}} e^{j 2\pi \frac{n}{4}} \\ \end{align}$$

because $ \left(e^{-j 2\pi \frac{n}{4}} \right)^4 = 1 $ for any integer $n$.

So the normalized pole is:

$$ \frac{p_n}{2 \pi f_0} \ = \ -1 \ + \ \big(G_\mathrm{R}\big)^{\frac{1}{4}} \ e^{j 2\pi \frac{n}{4}} \qquad \qquad \qquad n \in \mathbb{Z}$$

That's it for now. I will have to return to this later within 24 hours.

$\endgroup$
2
  • 1
    $\begingroup$ In case you can find the time to finish up your answer, I'd be happy to read it :-) $\endgroup$ Jan 28 at 4:08
  • 2
    $\begingroup$ Sorry, I had been distracted a couple of days. I am involved with redistricting in my state and city. That occupies most of my conscious thinking at the moment. I will get to this today. I'll show you where the poles go and you can cascade two simple Cookbook LPFs. $\endgroup$ Jan 28 at 16:27
2
$\begingroup$

If it were a linear filter, it'd be easy. The following doesn't apply to your Moog filters, apparently.

This approach is covered extensively in the literature, so the short answer is to get a book on DSP*, read up through the chapter on implementing a DSP filter from an analog prototype, then do what it says.

There's several different methods, each of which is good in its way.

  1. Use the bilinear transform, possibly with frequency warping. This is covered in every book, and if you're sampling fast enough, it works very well.
  2. Take your anti-alias and reconstruction filters into account, and design digital filters that give you a similar outcome in the frequency domain.

If I want to write a program that behaves exactly the same as the device, what method would you suggest?

You can't -- you can only come close enough. But then, if you had a dozen "identical" devices, even pro-quality ones, they wouldn't really be the same either.

Coming close enough involves sampling fast enough, getting your anti-aliasing and reconstruction filters right, and not screwing up your data paths in the digital realm.

"How fast do I sample?" -- you start with a guess (I'd go with 96 or 192ksps, as a handy 2x or 4x of a typical sampling rate). Then you design prototype filters and look at their frequency response, then you run actual audio through them and run them by the shiniest golden ears you can and you get an opinion.

* I.e. "Understanding Digital Signal Processing" by Rick Lyons.

$\endgroup$
8
  • 2
    $\begingroup$ I'm afraid this answer does not really apply to Moog transistor ladder low pass filter. This filter is designed to be strongly non-linear and its character comes this very property. The ability of the Moog filter to form stable self-oscillations demonstrates the non-linear character very well. So your recommendations would work for a very clean analog EQ, for example, but they're not getting you anywhere close to the original for most musical VCFs used in analog synths. $\endgroup$
    – Jazzmaniac
    Jan 25 at 21:35
  • $\begingroup$ Could you point this out to the OP so that they may modify their question, then? Because in that case then there's nine words out of somewhere around 200 that totally change the meaning of the question. The question either needs to be about linear filters in general, or it needs to say out loud that it's about nonlinear signal processing. $\endgroup$
    – TimWescott
    Jan 26 at 0:18
  • $\begingroup$ Actually Jazz, I have done 4-pole Moog filters as a cascade of two simple biquads. They sound pretty good and they're in Kurzweil synths now. Just get the poles right when translating to digital. The non-linear stuff happens when you crank the "regeneration" knob of the Moog way up and it oscillates. But as a "Voltage-controlled Filter" (VCF), the linear 4-pole "Mogue" filters with adjustable frequency and "regeneration" (the feedback path) sound pretty good. $\endgroup$ Jan 26 at 2:05
  • 1
    $\begingroup$ @robertbristow-johnson Of course you can linearize the the Moog Ladder LP. I've never claimed that it couldn't be "done". It just doesn't capture the original character, at all, unless you drive it at very low amplitudes with very low resonance settings. Since the OP explicitly asked for a digital realisation that captures the analogue character, it's clear that this does not answer his question. It's also not particularly hard to capture the nonlinearities in the filter. And if you're clever, it's not even computationally demanding. $\endgroup$
    – Jazzmaniac
    Jan 26 at 9:29
  • $\begingroup$ Even though I can't disagree any of who commented, frankly i found Tim's answer helpful, as i mentioned above i am looking for "concept(s)" that will work for me in modeling analog filters of various types. Please correct me if I'm wrong, doesn't this require both linear and non-linear signal processing? $\endgroup$ Jan 26 at 9:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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